![]() |
HeadBall
1.0
A game
|
The class that manages the states in the project. More...
#include <StateMachine.hpp>

Public Member Functions | |
| StateMachine () | |
| Construct a new State Machine object. More... | |
| ~StateMachine () | |
| Destroy the State Machine object. More... | |
| void | addState (StateRef newState, bool isReplacing=true) |
| Add a new state to the state machine. More... | |
| void | removeState () |
| Remove the state at the top of the stack. More... | |
| void | processStateChanges () |
| Process the changes in the state. More... | |
| StateRef & | getActiveState () |
| Get the Active State object i.e the state at the top of the stack. More... | |
Private Attributes | |
| std::stack< StateRef > | _states |
| The stack where the states in the game are kept. More... | |
| StateRef | _newState |
| The Unique Pointer to new state that is beong added. More... | |
| bool | _isReplacing |
| Whether the state at the top of stack is being popped or another state is being pushed at the top of it. More... | |
| bool | _isAdding |
| Whether a new state is being added. More... | |
| bool | _isRemoving |
| Whether the state at the top of stack is being popped. More... | |
The class that manages the states in the project.
This class manages all the states in the game in a stack. In every game loop, the state at the top of the stack is resumed.
|
inline |
Construct a new State Machine object.
|
inline |
Destroy the State Machine object.
| void HeadBall::StateMachine::addState | ( | StateRef | newState, |
| bool | isReplacing = true |
||
| ) |
Add a new state to the state machine.
| newState | The Unique Pointer to new state |
| isReplacing | Whether the top state at the stack is being replaced or another state is being pushed at the top of it |
| StateRef & HeadBall::StateMachine::getActiveState | ( | ) |
Get the Active State object i.e the state at the top of the stack.
| void HeadBall::StateMachine::processStateChanges | ( | ) |
Process the changes in the state.
| void HeadBall::StateMachine::removeState | ( | ) |
Remove the state at the top of the stack.
|
private |
Whether a new state is being added.
|
private |
Whether the state at the top of stack is being popped.
|
private |
Whether the state at the top of stack is being popped or another state is being pushed at the top of it.
|
private |
The Unique Pointer to new state that is beong added.
|
private |
The stack where the states in the game are kept.