aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.h')
-rw-r--r--src/app.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/app.h b/src/app.h
new file mode 100644
index 0000000..8edbe58
--- /dev/null
+++ b/src/app.h
@@ -0,0 +1,37 @@
1#ifndef MIC_APP_H
2#define MIC_APP_H
3
4#include "shorthand.h"
5#include "platform.h"
6
7#define LT_MEMORY_SIZE GB(2)
8#define ST_MEMORY_SIZE MB(100)
9
10typedef struct AppState {
11 // Long and short term memory.
12 char *lt_memory;
13 char *st_memory;
14} AppState;
15
16// Function pointers for the AppAPI.
17typedef struct AppAPI {
18 // Initialization code. Meant to be called exactly once before other API
19 // interactions. Returns the success or failure of the initialization
20 // process.
21 bool (*init)(AppState *state, PlatformAPI platform);
22
23 // Resource deallocation and cleanup. Meant to be called exactly once at the
24 // end of the app.
25 void (*destroy)(AppState *state, PlatformAPI platform);
26
27 // In case of hot code reloading, these functions handle the necessary
28 // resource setup and reloading.
29 void (*reload)(AppState *state, PlatformAPI platform);
30 void (*unload)(AppState *state, PlatformAPI platform);
31
32 // Main update/step function for the app. Returns if the app should keep
33 // running.
34 bool (*step)(AppState *state, PlatformAPI platform);
35} AppAPI;
36
37#endif // MIC_APP_H