Mercurial > molko
comparison src/main.c @ 39:9d1421c09dfb
core: add more utilities to improve code simplicity
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 14 Jan 2020 13:05:45 +0100 |
parents | 798baf7f3ec0 |
children | 3996f873a54b |
comparison
equal
deleted
inserted
replaced
38:83ae0e13c416 | 39:9d1421c09dfb |
---|---|
17 */ | 17 */ |
18 | 18 |
19 #include <stdio.h> | 19 #include <stdio.h> |
20 #include <stdlib.h> | 20 #include <stdlib.h> |
21 | 21 |
22 #include "clock.h" | |
23 #include "error.h" | |
24 #include "event.h" | |
25 #include "painter.h" | |
22 #include "sys.h" | 26 #include "sys.h" |
27 #include "window.h" | |
28 #include "util.h" | |
23 | 29 |
24 int | 30 int |
25 main(int argc, char **argv) | 31 main(int argc, char **argv) |
26 { | 32 { |
27 (void)argc; | 33 (void)argc; |
28 (void)argv; | 34 (void)argv; |
29 | 35 |
30 printf("[%s]\n", sys_datapath("foo.map")); | 36 struct clock clock; |
37 | |
38 if (!sys_init()) | |
39 error_fatal(); | |
40 if (!window_init("Molko's Adventure", 1024, 576)) | |
41 error_fatal(); | |
42 | |
43 clock_start(&clock); | |
44 | |
45 for (;;) { | |
46 /*uint64_t elapsed = clock_elapsed(&clock);*/ | |
47 union event ev; | |
48 | |
49 while (event_poll(&ev)) { | |
50 switch (ev.type) { | |
51 case EVENT_QUIT: | |
52 return 0; | |
53 default: | |
54 break; | |
55 } | |
56 } | |
57 | |
58 painter_clear(); | |
59 painter_present(); | |
60 delay(50); | |
61 } | |
31 | 62 |
32 return 0; | 63 return 0; |
33 } | 64 } |