gamestate: Add GetGamestateName function

This commit is contained in:
Sebastian Krzyszkowiak 2023-04-13 04:03:11 +02:00
parent 1d569e9913
commit 7131334d6a
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 5 additions and 0 deletions

View file

@ -254,6 +254,10 @@ SYMBOL_EXPORT ALLEGRO_BITMAP* GetGamestateFramebuffer(struct Game* game, struct
return gamestate->fb; return gamestate->fb;
} }
SYMBOL_EXPORT char* GetGamestateName(struct Game* game, struct Gamestate* gamestate) {
return AddGarbage(game, strdup(gamestate->name));
}
SYMBOL_EXPORT struct Gamestate* GetNextGamestate(struct Game* game, struct Gamestate* gamestate) { SYMBOL_EXPORT struct Gamestate* GetNextGamestate(struct Game* game, struct Gamestate* gamestate) {
if (!gamestate) { if (!gamestate) {
return game->_priv.gamestates; return game->_priv.gamestates;

View file

@ -67,6 +67,7 @@ void UnloadCurrentGamestate(struct Game* game);
struct Gamestate* GetCurrentGamestate(struct Game* game); struct Gamestate* GetCurrentGamestate(struct Game* game);
struct Gamestate* GetGamestate(struct Game* game, const char* name); struct Gamestate* GetGamestate(struct Game* game, const char* name);
ALLEGRO_BITMAP* GetGamestateFramebuffer(struct Game* game, struct Gamestate* gamestate); ALLEGRO_BITMAP* GetGamestateFramebuffer(struct Game* game, struct Gamestate* gamestate);
char* GetGamestateName(struct Game* game, struct Gamestate* gamestate);
struct Gamestate* GetNextGamestate(struct Game* game, struct Gamestate* gamestate); struct Gamestate* GetNextGamestate(struct Game* game, struct Gamestate* gamestate);
bool IsGamestateVisible(struct Game* game, struct Gamestate* gamestate); bool IsGamestateVisible(struct Game* game, struct Gamestate* gamestate);