From f76968f126c71cf555f2a20f57912f12af5f4a0f Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 10 Oct 2022 20:15:42 -0700 Subject: main: add emscripten main loop integration With emscripten builds we need to let emscripten own the main loop, hence why play_run_slice() was added. For non-emscripten builds nothing is different. --- src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.c b/src/main.c index c54e18c..d68bfac 100644 --- a/src/main.c +++ b/src/main.c @@ -14,6 +14,9 @@ * along with this program. If not, see . */ +#ifdef __EMSCRIPTEN__ +#include +#endif #include extern const play_ops_t sars_ops; @@ -33,7 +36,11 @@ int main(int argc, char *argv[]) play = play_startup(argc, argv, 0, ops); +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop_arg((void(*)(void *))play_run_slice, play, -1, 1); +#else play_run(play); +#endif return play_shutdown(play); } -- cgit v1.2.3