From 08ee8f142c881694a9b4fd3be6ef0431e926a5cc Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Fri, 11 Jan 2019 02:33:48 +0100 Subject: [PATCH] loading screen drawing tweaks --- src/internal.c | 2 +- src/mainloop.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index 5d4f7fa..250d944 100644 --- a/src/internal.c +++ b/src/internal.c @@ -57,7 +57,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) { tmp = tmp->next; } - if (game->_priv.loading.in_progress && game->loading.shown) { + if (game->loading.shown) { // same as above, but for the loading gamestate game->_priv.current_gamestate = NULL; SetFramebufferAsTarget(game); diff --git a/src/mainloop.c b/src/mainloop.c index 47330cb..c77696b 100644 --- a/src/mainloop.c +++ b/src/mainloop.c @@ -371,14 +371,21 @@ static inline bool MainloopTick(struct Game* game) { PrintConsole(game, "Gamestate \"%s\" loaded successfully in %f seconds.", tmp->name, al_get_time() - time); game->_priv.loading.loaded++; + DrawGamestates(game); + DrawConsole(game); + al_flip_display(); +#ifdef __EMSCRIPTEN__ + emscripten_sleep(0); +#endif + tmp->loaded = true; tmp->pending_load = false; } if (tmp->show_loading) { (*game->_priv.loading.gamestate->api->stop)(game, game->_priv.loading.gamestate->data); - game->loading.shown = false; } tmp->show_loading = true; + game->loading.shown = false; game->_priv.timestamp = al_get_time(); #ifdef __EMSCRIPTEN__ al_attach_mixer_to_voice(game->audio.mixer, game->audio.v); @@ -424,6 +431,9 @@ static inline bool MainloopTick(struct Game* game) { if (!gameActive) { PrintConsole(game, "No gamestates left, exiting..."); + ClearScreen(game); + DrawConsole(game); + al_flip_display(); return false; }