emscripten: pause the mainloop during loading

Fixes blinks of a blank screen when async calls are made.
This commit is contained in:
Sebastian Krzyszkowiak 2019-01-11 02:34:22 +01:00
parent 08ee8f142c
commit 2333ff1187
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -243,6 +243,10 @@ static inline bool MainloopTick(struct Game* game) {
struct Gamestate* tmp = game->_priv.gamestates;
#ifdef __EMSCRIPTEN__
emscripten_pause_main_loop();
#endif
game->_priv.loading.to_load = 0;
game->_priv.loading.loaded = 0;
game->_priv.loading.lock = true;
@ -428,6 +432,9 @@ static inline bool MainloopTick(struct Game* game) {
}
game->_priv.loading.lock = false;
#ifdef __EMSCRIPTEN__
emscripten_resume_main_loop();
#endif
if (!gameActive) {
PrintConsole(game, "No gamestates left, exiting...");