diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/app.c b/src/app.c new file mode 100644 index 0000000..a39bff0 --- /dev/null +++ b/src/app.c | |||
@@ -0,0 +1,44 @@ | |||
1 | #include "app.h" | ||
2 | #include "platform.h" | ||
3 | |||
4 | static inline bool | ||
5 | app_init(AppState *state, PlatformAPI platform) { | ||
6 | platform.log("INIT"); | ||
7 | state->lt_memory = platform.calloc(LT_MEMORY_SIZE, sizeof(u8)); | ||
8 | state->st_memory = platform.calloc(ST_MEMORY_SIZE, sizeof(u8)); | ||
9 | return true; | ||
10 | } | ||
11 | |||
12 | static inline void | ||
13 | app_destroy(AppState *state, PlatformAPI platform) { | ||
14 | (void)state; // Unused parameter. | ||
15 | platform.log("DESTROY"); | ||
16 | } | ||
17 | |||
18 | static inline void | ||
19 | app_reload(AppState *state, PlatformAPI platform) { | ||
20 | (void)state; // Unused parameter. | ||
21 | platform.log("RELOAD"); | ||
22 | } | ||
23 | |||
24 | static inline void | ||
25 | app_unload(AppState *state, PlatformAPI platform) { | ||
26 | (void)state; // Unused parameter. | ||
27 | platform.log("UNLOAD"); | ||
28 | } | ||
29 | |||
30 | static inline bool | ||
31 | app_step(AppState *state, PlatformAPI platform) { | ||
32 | (void)state; // Unused parameter. | ||
33 | platform.log("STEP"); | ||
34 | platform.sleep(100000); | ||
35 | return true; | ||
36 | } | ||
37 | |||
38 | const AppAPI APP_API = { | ||
39 | .init = app_init, | ||
40 | .destroy = app_destroy, | ||
41 | .reload = app_reload, | ||
42 | .step = app_step, | ||
43 | .unload = app_unload, | ||
44 | }; | ||