mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-08 06:06:43 +01:00
add a separate flag to indicate that the loading screen is being shown
This commit is contained in:
parent
0ebb85a660
commit
ad26fe14ad
3 changed files with 4 additions and 1 deletions
|
@ -30,7 +30,7 @@ SYMBOL_INTERNAL void SimpleCompositor(struct Game* game, struct Gamestate* games
|
|||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
if (game->_priv.loading.inProgress) {
|
||||
if (game->_priv.loading.shown) {
|
||||
al_draw_bitmap(game->loading_fb, game->_priv.clip_rect.x, game->_priv.clip_rect.y, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ struct Game {
|
|||
int progress;
|
||||
int loaded, toLoad;
|
||||
volatile bool inProgress;
|
||||
bool shown;
|
||||
double time;
|
||||
} loading;
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ static inline bool MainloopTick(struct Game* game) {
|
|||
while (game->_priv.loading.inProgress) {
|
||||
double delta = al_get_time() - game->_priv.loading.time;
|
||||
if (tmp->showLoading) {
|
||||
game->_priv.loading.shown = true;
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Logic)(game, game->_priv.loading.gamestate->data, delta);
|
||||
DrawGamestates(game);
|
||||
}
|
||||
|
@ -306,6 +307,7 @@ static inline bool MainloopTick(struct Game* game) {
|
|||
}
|
||||
if (tmp->showLoading) {
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Stop)(game, game->_priv.loading.gamestate->data);
|
||||
game->_priv.loading.shown = false;
|
||||
}
|
||||
tmp->showLoading = true;
|
||||
al_resume_timer(game->_priv.timer);
|
||||
|
|
Loading…
Reference in a new issue