diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-12-23 00:19:19 -0700 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-12-23 00:19:19 -0700 |
commit | 2c046ef3dca9e128a801c7a92c3a3a63e01fdd98 (patch) | |
tree | da7261da961ba59ba8799f0aa441dbb47b22ed25 /src | |
parent | 670ef2efe90f94a950a4465ce029fb07d2a6ae73 (diff) |
Ready for web assembly
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -1,13 +1,28 @@ #include "gameCommon.h" #include "game.h" +//#define PLATFORM_WEB + +#if defined(PLATFORM_WEB) + #include <emscripten/emscripten.h> +#endif + +Game game; + +void updateFrame() { + updateGame(&game); +} + int main(int argc, char ** argv) { - Game game; initGame(&game); - while (!WindowShouldClose()) { - updateGame(&game); - } +#if defined(PLATFORM_WEB) + emscripten_set_main_loop(updateFrame, 0, 1); +#else + while (!WindowShouldClose()) { + updateFrame(); + } +#endif closeGame(&game); return 0; |