7 #ifndef NDK_STATEMACHINE_HPP 8 #define NDK_STATEMACHINE_HPP 10 #include <NDK/Prerequesites.hpp> 11 #include <NDK/State.hpp> 20 inline StateMachine(std::shared_ptr<State> originalState);
25 inline void ChangeState(std::shared_ptr<State> state);
31 inline std::shared_ptr<State>
PopState();
33 inline void PushState(std::shared_ptr<State> state);
35 inline void SetState(std::shared_ptr<State> state);
37 inline bool Update(
float elapsedTime);
43 std::vector<std::shared_ptr<State>> m_states;
47 #include <NDK/StateMachine.inl> 49 #endif // NDK_STATEMACHINE_HPP TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
bool Update(float elapsedTime)
Updates all the states.
Definition: StateMachine.inl:168
void SetState(std::shared_ptr< State > state)
Pops every states of the machine to put a new one.
Definition: StateMachine.inl:150
const std::shared_ptr< State > & GetCurrentState() const
Gets the current state on the top of the machine.
Definition: StateMachine.inl:67
~StateMachine()
Destructs the object.
Definition: StateMachine.inl:37
NDK class that represents a state machine, to represent the multiple states of your program as a stac...
Definition: StateMachine.hpp:17
NDK class that represents a state of your application.
Definition: State.hpp:16
void ChangeState(std::shared_ptr< State > state)
Replaces the current state on the top of the machine.
Definition: StateMachine.inl:49
bool PopStatesUntil(std::shared_ptr< State > state)
Pops all the states of the machine until a specific one is reached.
Definition: StateMachine.inl:114
std::shared_ptr< State > PopState()
Pops the state on the top of the machine.
Definition: StateMachine.inl:94
void PushState(std::shared_ptr< State > state)
Pushes a new state on the top of the machine.
Definition: StateMachine.inl:133
bool IsTopState(const State *state) const
Checks whether the state is on the top of the machine.
Definition: StateMachine.inl:79
StateMachine(std::shared_ptr< State > originalState)
Constructs a StateMachine object with an original state.
Definition: StateMachine.inl:25