NDK class that represents a state machine, to represent the multiple states of your program as a stack.
More...
NDK class that represents a state machine, to represent the multiple states of your program as a stack.
◆ StateMachine()
Ndk::StateMachine::StateMachine |
( |
std::shared_ptr< State > |
originalState | ) |
|
|
inline |
Constructs a StateMachine object with an original state.
- Parameters
-
originalState | State which is the entry point of the application |
◆ ~StateMachine()
Ndk::StateMachine::~StateMachine |
( |
| ) |
|
|
inline |
◆ ChangeState()
void Ndk::StateMachine::ChangeState |
( |
std::shared_ptr< State > |
state | ) |
|
|
inline |
Replaces the current state on the top of the machine.
- Parameters
-
state | State to replace the top one if it is nullptr, no action is performed |
◆ GetCurrentState()
const std::shared_ptr< State > & Ndk::StateMachine::GetCurrentState |
( |
| ) |
const |
|
inline |
Gets the current state on the top of the machine.
- Returns
- A constant reference to the state
- See also
- PopStatesUntil
◆ IsTopState()
bool Ndk::StateMachine::IsTopState |
( |
const State * |
state | ) |
const |
|
inline |
Checks whether the state is on the top of the machine.
- Returns
- true If it is the case
- Parameters
-
state | State to compare the top with |
◆ PopState()
std::shared_ptr< State > Ndk::StateMachine::PopState |
( |
| ) |
|
|
inline |
Pops the state on the top of the machine.
- Returns
- Old state on the top, nullptr if stack was empty
◆ PopStatesUntil()
bool Ndk::StateMachine::PopStatesUntil |
( |
std::shared_ptr< State > |
state | ) |
|
|
inline |
Pops all the states of the machine until a specific one is reached.
- Returns
- true If that specific state is on top, false if stack is empty
- Parameters
-
state | State to find on the stack if it is nullptr, no action is performed |
◆ PushState()
void Ndk::StateMachine::PushState |
( |
std::shared_ptr< State > |
state | ) |
|
|
inline |
Pushes a new state on the top of the machine.
- Parameters
-
state | Next state to represent if it is nullptr, it performs no action |
◆ SetState()
void Ndk::StateMachine::SetState |
( |
std::shared_ptr< State > |
state | ) |
|
|
inline |
Pops every states of the machine to put a new one.
- Parameters
-
state | State to reset the stack with if it is nullptr, no action is performed |
◆ Update()
bool Ndk::StateMachine::Update |
( |
float |
elapsedTime | ) |
|
|
inline |
Updates all the states.
- Returns
- true If update is successful for everyone of them
- Parameters
-
elapsedTime | Delta time used for the update |
The documentation for this class was generated from the following files: