aboutsummaryrefslogtreecommitdiff
path: root/eng/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'eng/src/main.c')
-rw-r--r--eng/src/main.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/eng/src/main.c b/eng/src/main.c
new file mode 100644
index 0000000..8bead36
--- /dev/null
+++ b/eng/src/main.c
@@ -0,0 +1,31 @@
+static int mainloop(void *udata);
+
+static Game *game = NULL;
+static void game_free(void) { if (game) game_destroy(game); game = NULL; }
+
+int
+main(int argc, char **argv)
+{
+ if (TZR_Init(DWIDTH, DHEIGHT, .scale=SCALE, .target_fps=FPS, .basepath="."))
+ panic("TZR_Init failed");
+ defer(TZR_Quit);
+
+ game = game_create();
+ defer(game_free);
+
+ srand(time(NULL));
+
+ TZR_MainLoop(mainloop, game);
+ return 0;
+}
+
+static int
+mainloop(void *udata)
+{
+ game_update(udata);
+
+ TZR_DrawBegin();
+ game_draw(udata);
+ TZR_DrawEnd();
+ return 0;
+}