Minor main loop change for Emscripten
This commit is contained in:
@@ -42,12 +42,6 @@ namespace lime {
|
|||||||
|
|
||||||
framePeriod = 1000.0 / 60.0;
|
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;
|
currentUpdate = 0;
|
||||||
lastUpdate = 0;
|
lastUpdate = 0;
|
||||||
nextUpdate = 0;
|
nextUpdate = 0;
|
||||||
@@ -95,6 +89,12 @@ namespace lime {
|
|||||||
|
|
||||||
Init ();
|
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)
|
#if defined(IPHONE) || defined(EMSCRIPTEN)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -893,7 +893,7 @@ namespace lime {
|
|||||||
|
|
||||||
currentUpdate = SDL_GetTicks ();
|
currentUpdate = SDL_GetTicks ();
|
||||||
|
|
||||||
#if defined (IPHONE)
|
#if defined (IPHONE) || defined (EMSCRIPTEN)
|
||||||
|
|
||||||
if (currentUpdate >= nextUpdate) {
|
if (currentUpdate >= nextUpdate) {
|
||||||
|
|
||||||
@@ -903,12 +903,6 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (EMSCRIPTEN)
|
|
||||||
|
|
||||||
event.type = SDL_USEREVENT;
|
|
||||||
HandleEvent (&event);
|
|
||||||
event.type = -1;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (currentUpdate >= nextUpdate) {
|
if (currentUpdate >= nextUpdate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user