diff options
author | quou <quou@disroot.org> | 2024-10-12 00:23:57 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-10-12 00:24:07 +1100 |
commit | 7a7628a3feaec81d9a445acbec604baecac3a167 (patch) | |
tree | 962d56698071cdf5766083b77fa05607b9e37668 /hftrss.c | |
parent | c5445eb3032f2081c8cf798e03b088b64b016a1f (diff) |
sdl + emscripten backend
Diffstat (limited to 'hftrss.c')
-rw-r--r-- | hftrss.c | 49 |
1 files changed, 27 insertions, 22 deletions
@@ -6,14 +6,13 @@ #include "plat.h" #include "render.h" -int entrypoint(int argc, const char** argv, Arena* m) { - Heap h; - App* a; - FPS f; - Renderer r; - Game* game; - (void)argc; - (void)argv; +static Heap h; +static App* a; +static FPS f; +static Renderer r; +static Game* game; + +int prog_init(Arena* m) { init_maths(); init_heap( &h, @@ -25,21 +24,27 @@ int entrypoint(int argc, const char** argv, Arena* m) { init_fps(&f, default_mpf); game = arena_alloc(m, sizeof *game); init_game(game, game_state_menu); - while (a->o) { - fps_begin(&f); - while (f.now >= f.next && a->o) { - app_begin(a); - update_game(game, a); - ren_begin(&r, a->fb, viewport_w, viewport_h); - ren_clear(&r); - ren_game(game, &r); - ren_end(&r); - app_end(a); - fps_update(&f); - } - fps_end(&f); + return 0; +} + +int prog_update(void) { + fps_begin(&f); + while (f.now >= f.next && a->o) { + app_begin(a); + update_game(game, a); + ren_begin(&r, a->fb, viewport_w, viewport_h); + ren_clear(&r); + ren_game(game, &r); + ren_end(&r); + app_end(a); + fps_update(&f); } + fps_end(&f); + return a->o; +} + +void prog_deinit(void) { deinit_audio(); deinit_app(a); - return error_none; } + |