loading screen drawing tweaks

This commit is contained in:
Sebastian Krzyszkowiak 2019-01-11 02:33:48 +01:00
parent 0d32d00890
commit 08ee8f142c
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 12 additions and 2 deletions

View file

@ -57,7 +57,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
tmp = tmp->next; tmp = tmp->next;
} }
if (game->_priv.loading.in_progress && game->loading.shown) { if (game->loading.shown) {
// same as above, but for the loading gamestate // same as above, but for the loading gamestate
game->_priv.current_gamestate = NULL; game->_priv.current_gamestate = NULL;
SetFramebufferAsTarget(game); SetFramebufferAsTarget(game);

View file

@ -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); PrintConsole(game, "Gamestate \"%s\" loaded successfully in %f seconds.", tmp->name, al_get_time() - time);
game->_priv.loading.loaded++; game->_priv.loading.loaded++;
DrawGamestates(game);
DrawConsole(game);
al_flip_display();
#ifdef __EMSCRIPTEN__
emscripten_sleep(0);
#endif
tmp->loaded = true; tmp->loaded = true;
tmp->pending_load = false; tmp->pending_load = false;
} }
if (tmp->show_loading) { if (tmp->show_loading) {
(*game->_priv.loading.gamestate->api->stop)(game, game->_priv.loading.gamestate->data); (*game->_priv.loading.gamestate->api->stop)(game, game->_priv.loading.gamestate->data);
game->loading.shown = false;
} }
tmp->show_loading = true; tmp->show_loading = true;
game->loading.shown = false;
game->_priv.timestamp = al_get_time(); game->_priv.timestamp = al_get_time();
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
al_attach_mixer_to_voice(game->audio.mixer, game->audio.v); al_attach_mixer_to_voice(game->audio.mixer, game->audio.v);
@ -424,6 +431,9 @@ static inline bool MainloopTick(struct Game* game) {
if (!gameActive) { if (!gameActive) {
PrintConsole(game, "No gamestates left, exiting..."); PrintConsole(game, "No gamestates left, exiting...");
ClearScreen(game);
DrawConsole(game);
al_flip_display();
return false; return false;
} }