Minor main loop change for Emscripten

This commit is contained in:
Joshua Granick
2023-05-23 20:49:54 -07:00
parent a05ee5a009
commit 79e11e4270

View File

@@ -42,12 +42,6 @@ namespace lime {
framePeriod = 1000.0 / 60.0;
#ifdef EMSCRIPTEN
emscripten_cancel_main_loop ();
emscripten_set_main_loop (UpdateFrame, 0, 0);
emscripten_set_main_loop_timing (EM_TIMING_RAF, 1);
#endif
currentUpdate = 0;
lastUpdate = 0;
nextUpdate = 0;
@@ -95,6 +89,12 @@ namespace lime {
Init ();
#ifdef EMSCRIPTEN
emscripten_cancel_main_loop ();
emscripten_set_main_loop (UpdateFrame, 0, 0);
emscripten_set_main_loop_timing (EM_TIMING_RAF, 1);
#endif
#if defined(IPHONE) || defined(EMSCRIPTEN)
return 0;
@@ -893,7 +893,7 @@ namespace lime {
currentUpdate = SDL_GetTicks ();
#if defined (IPHONE)
#if defined (IPHONE) || defined (EMSCRIPTEN)
if (currentUpdate >= nextUpdate) {
@@ -903,12 +903,6 @@ namespace lime {
}
#elif defined (EMSCRIPTEN)
event.type = SDL_USEREVENT;
HandleEvent (&event);
event.type = -1;
#else
if (currentUpdate >= nextUpdate) {