Mountain  1.0.0
Simple C++ 2D Game Framework
Mountain::StateMachine< T > Class Template Reference
+ Inheritance diagram for Mountain::StateMachine< T >:
+ Collaboration diagram for Mountain::StateMachine< T >:

Public Types

using Type = T
 
using UnderlyingType = Meta::UnderlyingEnumType< T >
 

Public Member Functions

 StateMachine (const StateMachine &)=delete
 
StateMachineoperator= (const StateMachine &)=delete
 
 StateMachine (StateMachine &&other) noexcept
 
StateMachineoperator= (StateMachine &&other) noexcept
 
void SetCallbacks (T state, StateMachineCallbacks &&callbacks)
 Set the callbacks for when a state begins, updates and ends.
 
void Update () override
 Updates the component.
 
T GetState () const
 Get the current state.
 
UnderlyingType GetStateIntegral () const
 Get the current state as an integral type.
 
void SetState (T newState)
 Set the new state if locked is not set.
 
void ForceState (T newState)
 Force the new state.
 
StateMachineoperator= (T newState)
 Set the new state if locked is not set.
 
T GetPreviousState () const
 Get the previous state.
 
UnderlyingType GetPreviousStateIntegral () const
 Get the previous state as an integral type.
 
bool_t GetStateChanged () const
 Get whether the current state changed since the last update.
 
 operator T ()
 
- Public Member Functions inherited from Mountain::Component
virtual void Added ()
 Called when the component is added to an Entity.
 
virtual void Removed ()
 Called when the component is removed from an Entity.
 
virtual void Render ()
 Renders the component.
 
virtual void DebugRender ()
 
const EntityGetEntity () const
 Get the Entity on which this Component is attached.
 
EntityGetEntity ()
 Get the Entity on which this Component is attached.
 

Public Attributes

bool_t locked = false
 

Additional Inherited Members

- Protected Attributes inherited from Mountain::Component
Entitym_Entity = nullptr
 Entity bound to the component.
 

Detailed Description

template<Concepts::EnumT T>
class Mountain::StateMachine< T >

Definition at line 23 of file state_machine.hpp.


The documentation for this class was generated from the following file: