All the possible states included here to make switching easier. More...
#include <StateManager.h>
Public Member Functions | |
| void | changeState (std::unique_ptr< State > newState) |
| Handles state changes. | |
| void | applyPendingState () |
| Updates the current state. | |
| void | pushState (std::unique_ptr< State > newState) |
| Push new state on top (use for pause menu, settings) | |
| void | popState () |
| Add new state on top. | |
| State * | currentState () |
| Remove top state. | |
| bool | isEmpty () const |
| void | update (sf::RenderWindow &window, StateManager &stateManager) |
| Handles individual states. | |
| void | render (sf::RenderWindow &window) |
| Render the current state. | |
All the possible states included here to make switching easier.
| void StateManager::applyPendingState | ( | ) |
Updates the current state.
Remove all states
| void StateManager::changeState | ( | std::unique_ptr< State > | newState | ) |
Handles state changes.
Queue the next state.
Store the new state
| State * StateManager::currentState | ( | ) |
Remove top state.
Get current state on top of stack.
|
inline |
| void StateManager::popState | ( | ) |
Add new state on top.
Remove top state and resume the previous one.
Remove top state
| void StateManager::pushState | ( | std::unique_ptr< State > | newState | ) |
Push new state on top (use for pause menu, settings)
| void StateManager::render | ( | sf::RenderWindow & | window | ) |
Render the current state.
| void StateManager::update | ( | sf::RenderWindow & | window, |
| StateManager & | stateManager ) |
Handles individual states.
Used for handling input and game updates.