19 #ifndef HEADER_ABSTRACT_STATE_MANAGER_HPP 20 #define HEADER_ABSTRACT_STATE_MANAGER_HPP 24 #include "guiengine/engine.hpp" 25 #include "guiengine/screen.hpp" 26 #include "utils/leak_check.hpp" 66 void pushMenu(
Screen* screen);
138 void hardResetAndGoToScreen()
142 GUIEngine::clearScreenCache();
144 T* instance = T::getInstance();
146 m_menu_stack.emplace_back(instance->getName(), instance);
152 onTopMostScreenChanged();
178 virtual void onTopMostScreenChanged() = 0;
185 return (
unsigned int)m_menu_stack.size();
GameState getGameState()
Definition: abstract_state_manager.cpp:74
void reshowTopMostMenu()
to be called after e.g.
Definition: abstract_state_manager.cpp:192
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
void resetAndGoToScreen(Screen *screen)
clears the menu stack and starts afresh with a new stack containing only the given screen ...
Definition: abstract_state_manager.cpp:263
void resetAndSetStack(Screen *screens[])
Sets the whole menu stack.
Definition: abstract_state_manager.cpp:290
virtual void escapePressed()=0
callback invoked whenever escape was pressed (or any similar cancel operation)
Dummy GameState e.
Definition: abstract_state_manager.hpp:45
void enterMenuState()
Used in no graphics STK to enter menu screen (when server is idle state)
Definition: abstract_state_manager.hpp:122
virtual void onStackEmptied()=0
callback invoked when the stack is emptied (all menus are popped out).
virtual void init()
Callback invoked when entering this menu (after the widgets have been added).
Definition: screen.cpp:96
GameState
Definition: abstract_state_manager.hpp:39
void enterGameState()
call to make the state manager enter game mode.
Definition: abstract_state_manager.cpp:50
void replaceTopMostScreen(Screen *screen, GUIEngine::GameState gameState=GUIEngine::CURRENT)
replaces the menu at the top of the screens stack (i.e.
Definition: abstract_state_manager.cpp:155
void switchToScreen(Screen *screen)
Low-level mean to change current screen.
Definition: engine.cpp:922
virtual void tearDown()
Callback invoked before leaving this menu.
Definition: screen.cpp:118
unsigned int getMenuStackSize() const
Returns the number of screens on the stack.
Definition: abstract_state_manager.hpp:183
Represents a single GUI screen.
Definition: screen.hpp:96
void popMenu()
removes the menu at the top of the screens stack If the stack becomes empty after performing the pop ...
Definition: abstract_state_manager.cpp:218
virtual void onGameStateChange(GameState new_state)=0
callback invoked when game mode changes (e.g.
std::vector< std::pair< std::string, Screen * > > m_menu_stack
This stack will contain menu names (e.g.
Definition: abstract_state_manager.hpp:64
void pushScreen(Screen *screen)
adds a menu at the top of the screens stack
Definition: abstract_state_manager.cpp:134
void onResize()
Called when resizing of stk window.
Definition: abstract_state_manager.cpp:317
GameState m_game_mode
Whether we are in game mode.
Definition: abstract_state_manager.hpp:58
Screen * getCurrentScreen()
Definition: engine.hpp:178
Abstract base class you must override from to use the GUI engine.
Definition: abstract_state_manager.hpp:52