SuperTuxKart
|
Abstract base class you must override from to use the GUI engine. More...
#include <abstract_state_manager.hpp>
Public Member Functions | |
AbstractStateManager () | |
inits an AbstractStateManager is MENU state | |
void | pushScreen (Screen *screen) |
adds a menu at the top of the screens stack | |
void | replaceTopMostScreen (Screen *screen, GUIEngine::GameState gameState=GUIEngine::CURRENT) |
replaces the menu at the top of the screens stack (i.e. | |
void | popMenu () |
removes the menu at the top of the screens stack If the stack becomes empty after performing the pop (i.e. | |
void | resetAndGoToScreen (Screen *screen) |
clears the menu stack and starts afresh with a new stack containing only the given screen | |
void | resetAndSetStack (Screen *screens[]) |
Sets the whole menu stack. | |
void | onResize () |
Called when resizing of stk window. | |
void | enterMenuState () |
Used in no graphics STK to enter menu screen (when server is idle state) | |
void | enterGameState () |
call to make the state manager enter game mode. | |
GameState | getGameState () |
void | reshowTopMostMenu () |
to be called after e.g. | |
template<typename T > | |
void | hardResetAndGoToScreen () |
virtual void | escapePressed ()=0 |
callback invoked whenever escape was pressed (or any similar cancel operation) | |
virtual void | onGameStateChange (GameState new_state)=0 |
callback invoked when game mode changes (e.g. | |
virtual void | onStackEmptied ()=0 |
callback invoked when the stack is emptied (all menus are popped out). | |
virtual void | onTopMostScreenChanged ()=0 |
unsigned int | getMenuStackSize () const |
Returns the number of screens on the stack. | |
Protected Member Functions | |
void | pushMenu (Screen *screen) |
void | setGameState (GameState state) |
Protected Attributes | |
std::atomic< GameState > | m_game_mode |
Whether we are in game mode. | |
std::vector< std::pair< std::string, Screen * > > | m_menu_stack |
This stack will contain menu names (e.g. | |
Abstract base class you must override from to use the GUI engine.
void AbstractStateManager::enterGameState | ( | ) |
call to make the state manager enter game mode.
Causes the menu stack to be cleared; all widgets shown on screen are removed
|
pure virtual |
callback invoked whenever escape was pressed (or any similar cancel operation)
Implemented in StateManager.
GameState AbstractStateManager::getGameState | ( | ) |
|
inline |
Returns the number of screens on the stack.
Is used to decide if exiting a screen would cause STK to end or not.
|
pure virtual |
callback invoked when game mode changes (e.g.
goes from "menu" to "in-game")
Implemented in StateManager.
|
pure virtual |
callback invoked when the stack is emptied (all menus are popped out).
This is essentially a request to close the application (since a game can't run without a state)
Implemented in StateManager.
|
pure virtual |
Implemented in StateManager.
void AbstractStateManager::popMenu | ( | ) |
removes the menu at the top of the screens stack If the stack becomes empty after performing the pop (i.e.
if it contained only one item prior to the call), the game is aborted. In other cases, the second-topmost screen is displayed.
void AbstractStateManager::replaceTopMostScreen | ( | Screen * | screen, |
GUIEngine::GameState | gameState = GUIEngine::CURRENT |
||
) |
replaces the menu at the top of the screens stack (i.e.
pops the topmost screen and adds this one instead, but without displaying the second-topmost menu of the stack in-between)
void AbstractStateManager::resetAndSetStack | ( | Screen * | screens[] | ) |
Sets the whole menu stack.
Only the topmost screen will be inited/shown, but others remain under for cases where the user wants to go back.
screens | an array containing the menus that should go into stack. The first item will be the bottom item in the stack, the last item will be the stack top. Array must be NULL-terminated. |
void AbstractStateManager::reshowTopMostMenu | ( | ) |
to be called after e.g.
a resolution switch
|
protected |
This stack will contain menu names (e.g.
main.stkgui), and/or 'race' with screen instance pointer.