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;
}
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);

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);
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;
}