add ChangeGamestate/ChangeCurrentGamestate API for replacing gamestates without unloading

This commit is contained in:
Sebastian Krzyszkowiak 2016-08-20 03:32:09 +02:00
parent 4aad8fabac
commit 63451eb858
2 changed files with 12 additions and 0 deletions

View file

@ -197,6 +197,16 @@ SYMBOL_EXPORT void SwitchGamestate(struct Game *game, const char* current, const
StartGamestate(game, n); StartGamestate(game, n);
} }
SYMBOL_EXPORT void ChangeGamestate(struct Game *game, const char* current, const char* n) {
StopGamestate(game, current);
LoadGamestate(game, n);
StartGamestate(game, n);
}
SYMBOL_EXPORT void SwitchCurrentGamestate(struct Game *game, const char* n) { SYMBOL_EXPORT void SwitchCurrentGamestate(struct Game *game, const char* n) {
SwitchGamestate(game, game->_priv.current_gamestate->name, n); SwitchGamestate(game, game->_priv.current_gamestate->name, n);
} }
SYMBOL_EXPORT void ChangeCurrentGamestate(struct Game *game, const char* n) {
ChangeGamestate(game, game->_priv.current_gamestate->name, n);
}

View file

@ -64,5 +64,7 @@ void ResumeGamestate(struct Game *game, const char* name);
void UnloadAllGamestates(struct Game *game); void UnloadAllGamestates(struct Game *game);
void SwitchGamestate(struct Game *game, const char* current, const char* n); void SwitchGamestate(struct Game *game, const char* current, const char* n);
void SwitchCurrentGamestate(struct Game *game, const char* n); void SwitchCurrentGamestate(struct Game *game, const char* n);
void ChangeGamestate(struct Game *game, const char* current, const char* n);
void ChangeCurrentGamestate(struct Game *game, const char* n);
#endif #endif