Finite State Machine manager class.
More...
#include <StateMachine.hpp>
|
|
| StateMachine () |
| | Default constructor.
|
|
| ~StateMachine () |
| | Destructor.
|
| uint32 | count () const |
| | Get the number of active states.
|
| uint32 | current_state_id (void) const |
| | Obtain the current state's identifier.
|
| uint32 | next_state_id (void) const |
| | Obtain the next state's identifier.
|
| void | set_state (std::unique_ptr< IState > state, void_ptr data) |
| void | pop_state (void_ptr data) |
| void | on_event (const Event &ev) |
| | Event handling logic for the active state.
|
| void | update (float delta) |
| | State logic handling.
|
|
void | draw (RenderWindow &) |
| | State rendering handling.
|
Finite State Machine manager class.
Definition at line 60 of file StateMachine.hpp.
◆ count()
| uint32 nom::StateMachine::count |
( |
| ) |
const |
Get the number of active states.
- Returns
- Total number of states in the stack.
◆ current_state_id()
| uint32 nom::StateMachine::current_state_id |
( |
void | | ) |
const |
Obtain the current state's identifier.
- Returns
- The identifier of the state, or an assertion on failure, such as if the the states stack is empty.
◆ next_state_id()
| uint32 nom::StateMachine::next_state_id |
( |
void | | ) |
const |
Obtain the next state's identifier.
- Returns
- The identifier of the next state (in the stack), or an assertion on failure, such as if the the states stack is empty.
◆ on_event()
| void nom::StateMachine::on_event |
( |
const Event & | ev | ) |
|
◆ pop_state()
| void nom::StateMachine::pop_state |
( |
void_ptr | data | ) |
|
◆ set_deferred_state()
| void nom::StateMachine::set_deferred_state |
( |
std::unique_ptr< IState > | state, |
|
|
void_ptr | data ) |
|
private |
Set the next state.
- Parameters
-
| state | The state to be put onto the stack. If NULL is passed, the current state exits and the next one after that is resumed. |
- Note
- Where on the stack the state is put is dependent upon the type of state defined (see also: nom::IState::Type enumeration).
◆ set_state()
| void nom::StateMachine::set_state |
( |
std::unique_ptr< IState > | state, |
|
|
void_ptr | data ) |
◆ update()
| void nom::StateMachine::update |
( |
float | delta | ) |
|
◆ next_state_
The pending state to be set on the next frame update.
Definition at line 140 of file StateMachine.hpp.
◆ states_
| std::vector<std::unique_ptr<IState> > nom::StateMachine::states_ |
|
private |
The documentation for this class was generated from the following file: