aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.c
blob: a39bff0d26b338092773a30c17283933f598e1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "app.h"
#include "platform.h"

static inline bool
app_init(AppState *state, PlatformAPI platform) {
    platform.log("INIT");
    state->lt_memory = platform.calloc(LT_MEMORY_SIZE, sizeof(u8));
    state->st_memory = platform.calloc(ST_MEMORY_SIZE, sizeof(u8));
    return true;
}

static inline void
app_destroy(AppState *state, PlatformAPI platform) {
    (void)state; // Unused parameter.
    platform.log("DESTROY");
}

static inline void
app_reload(AppState *state, PlatformAPI platform) {
    (void)state; // Unused parameter.
    platform.log("RELOAD");
}

static inline void
app_unload(AppState *state, PlatformAPI platform) {
    (void)state; // Unused parameter.
    platform.log("UNLOAD");
}

static inline bool
app_step(AppState *state, PlatformAPI platform) {
    (void)state; // Unused parameter.
    platform.log("STEP");
    platform.sleep(100000);
    return true;
}

const AppAPI APP_API = {
    .init = app_init,
    .destroy = app_destroy,
    .reload = app_reload,
    .step = app_step,
    .unload = app_unload,
};