aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index c0333c9..d827561 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;