The class that manages the states in the project.
Definition: StateMachine.hpp:23
bool _isReplacing
Whether the state at the top of stack is being popped or another state is being pushed at the top of ...
Definition: StateMachine.hpp:68
StateMachine()
Construct a new State Machine object.
Definition: StateMachine.hpp:29
StateRef & getActiveState()
Get the Active State object i.e the state at the top of the stack.
Definition: StateMachine.cpp:40
std::stack< StateRef > _states
The stack where the states in the game are kept.
Definition: StateMachine.hpp:65
bool _isRemoving
Whether the state at the top of stack is being popped.
Definition: StateMachine.hpp:70
void processStateChanges()
Process the changes in the state.
Definition: StateMachine.cpp:15
void addState(StateRef newState, bool isReplacing=true)
Add a new state to the state machine.
Definition: StateMachine.cpp:4
~StateMachine()
Destroy the State Machine object.
Definition: StateMachine.hpp:35
bool _isAdding
Whether a new state is being added.
Definition: StateMachine.hpp:69
void removeState()
Remove the state at the top of the stack.
Definition: StateMachine.cpp:11
StateRef _newState
The Unique Pointer to new state that is beong added.
Definition: StateMachine.hpp:66
Custom namespace used throughout the project.
Definition: AboutState.cpp:6
std::unique_ptr< State > StateRef
The Unique Pointer for storing the States.
Definition: StateMachine.hpp:15