mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-04 09:11:27 +01:00
loading: call Gamestate_Logic in single thread mode as well
This commit is contained in:
parent
a9c318dd78
commit
01ae741558
3 changed files with 7 additions and 3 deletions
|
@ -250,9 +250,12 @@ SYMBOL_INTERNAL void GamestateProgress(struct Game* game) {
|
|||
}
|
||||
#ifdef LIBSUPERDERPY_SINGLE_THREAD
|
||||
DrawGamestates(game);
|
||||
double delta = al_get_time() - game->_priv.loading.time;
|
||||
if (tmp->showLoading) {
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Logic)(game, game->_priv.loading.gamestate->data, delta);
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Draw)(game, game->_priv.loading.gamestate->data);
|
||||
}
|
||||
game->_priv.loading.time += delta;
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
#endif
|
||||
|
|
|
@ -398,19 +398,19 @@ SYMBOL_INTERNAL void libsuperderpy_mainloop(void* g) {
|
|||
|
||||
struct GamestateLoadingThreadData data = {.game = game, .gamestate = tmp, .bitmap_flags = al_get_new_bitmap_flags()};
|
||||
game->_priv.loading.inProgress = true;
|
||||
game->_priv.loading.time = al_get_time();
|
||||
|
||||
#ifndef LIBSUPERDERPY_SINGLE_THREAD
|
||||
al_run_detached_thread(GamestateLoadingThread, &data);
|
||||
double time = al_get_time();
|
||||
while (game->_priv.loading.inProgress) {
|
||||
DrawGamestates(game);
|
||||
al_set_target_backbuffer(game->display);
|
||||
double delta = al_get_time() - time;
|
||||
double delta = al_get_time() - game->_priv.loading.time;
|
||||
if (tmp->showLoading) {
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Logic)(game, game->_priv.loading.gamestate->data, delta);
|
||||
(*game->_priv.loading.gamestate->api->Gamestate_Draw)(game, game->_priv.loading.gamestate->data);
|
||||
}
|
||||
time += delta;
|
||||
game->_priv.loading.time += delta;
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ struct Game {
|
|||
int progress;
|
||||
int loaded, toLoad;
|
||||
bool inProgress;
|
||||
double time;
|
||||
} loading;
|
||||
|
||||
struct Gamestate* current_gamestate;
|
||||
|
|
Loading…
Add table
Reference in a new issue