call Gamestate_Pause and Gamestate_Resume on window focus change in debug mode (autoreload)

This commit is contained in:
Sebastian Krzyszkowiak 2018-07-18 19:47:56 +02:00
parent 3b2a675d23
commit 91a3bd1efa

View file

@ -527,6 +527,13 @@ SYMBOL_INTERNAL char* GetLibraryPath(struct Game* game, char* filename) {
}
SYMBOL_INTERNAL void PauseExecution(struct Game* game) {
struct Gamestate* tmp = game->_priv.gamestates;
while (tmp) {
if (!tmp->paused && tmp->loaded && tmp->api->Gamestate_Pause) {
tmp->api->Gamestate_Pause(game, tmp->data);
}
tmp = tmp->next;
}
game->_priv.paused = true;
PrintConsole(game, "DEBUG: game execution paused.");
}
@ -543,6 +550,9 @@ SYMBOL_INTERNAL void ResumeExecution(struct Game* game) {
if (tmp->api->Gamestate_Reload) {
tmp->api->Gamestate_Reload(game, tmp->data);
}
if (!tmp->paused && tmp->api->Gamestate_Resume) {
tmp->api->Gamestate_Resume(game, tmp->data);
}
}
tmp = tmp->next;
}