Session Class
Holds session-level state for the current game instance. More...
Declaration
Private Member Typedefs Index
| using | Handle_type = GameObject::Handle_type |
Public Constructors Index
| Session (const GameObject go) | |
|
Constructs a session with the given GameObject. More... | |
Public Member Functions Index
| bool | isInitialized () const noexcept |
| bool | initialize () noexcept |
| bool | isDestroyed () noexcept |
| void | destroy () noexcept |
| void | setPlayerEntityHandle (const Handle_type go) noexcept |
|
Sets the player entity handle. More... | |
| Handle_type | playerEntityHandle () const noexcept |
|
Returns the player entity handle. More... | |
| void | reset () |
|
Resets the session state. More... | |
template <typename StateType> | |
| void | setStateFrom (const StateTransitionContext< StateType > stateTransitionContext) noexcept |
|
Updates state from a transition context. More... | |
template <typename StateType> | |
| StateType | state () const noexcept |
|
Returns the current state for a given state type. More... | |
template <typename StateType> | |
| StateType | stateFrom () const noexcept |
|
Returns the source state of the last transition. More... | |
template <typename StateType> | |
| auto | stateTransitionId () const noexcept -> StateTransitionIdType< StateType > |
|
Returns the last transition ID for a given state type. More... | |
template <typename StateType> | |
| void | trackState () |
|
Lets this session track the specified StateType. More... | |
| void | setViewportHandles (std::span< const ViewportHandle > &viewportHandles) noexcept |
|
Replaces the active viewport IDs with the provided list. More... | |
| std::span< const ViewportHandle > | viewportHandles () const noexcept |
|
Returns the currently active viewport handles. More... | |
| bool | isActiveViewport (const ViewportHandle viewportHandle) const noexcept |
|
Returns true if the specified ViewportHandle is currently active. More... | |
| void | clearViewportHandles () noexcept |
|
Clears all active viewport handles. More... | |
Private Member Attributes Index
| GameObject | gameObject_ |
|
The underlying GameObject storing session components. More... | |
| Handle_type | playerEntity_ |
|
Handle to the player entity. More... | |
Description
Holds session-level state for the current game instance.
The Session wraps a GameObject that stores session-related components using the template-based state system. It provides type-safe accessors for any registered state type (e.g., GameState, MatchState).
State types must be registered via trackState<T>() before use:
Definition at line 61 of file Session.ixx.
Private Member Typedefs
Handle_type
|
Definition at line 63 of file Session.ixx.
Public Constructors
Session()
| inline explicit |
Constructs a session with the given GameObject.
Automatically adds ActiveViewportHandlesStateComponent. State types must be registered separately via trackState<T>().
- Parameters
-
go The GameObject to use as the session entity.
Definition at line 85 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
Public Member Functions
clearViewportHandles()
| inline noexcept |
Clears all active viewport handles.
Definition at line 232 of file Session.ixx.
destroy()
| inline noexcept |
Definition at line 102 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
initialize()
| inline noexcept |
Definition at line 94 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
isActiveViewport()
| inline noexcept |
Returns true if the specified ViewportHandle is currently active.
- Parameters
-
viewportHandle The ViewportHandle to check for activity.
- Returns
true if the ViewportHandle is considered active, otherwise false.
Definition at line 225 of file Session.ixx.
isDestroyed()
| inline noexcept |
Definition at line 98 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
Referenced by helios::engine::runtime::gameloop::GameLoop::isRunning.
isInitialized()
| inline noexcept |
Definition at line 90 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
playerEntityHandle()
| inline noexcept |
Returns the player entity handle.
- Returns
The player's entity handle.
Definition at line 120 of file Session.ixx.
reset()
| inline |
Resets the session state.
Definition at line 127 of file Session.ixx.
Referenced by helios::engine::runtime::world::GameWorld::reset.
setPlayerEntityHandle()
| inline noexcept |
Sets the player entity handle.
- Parameters
-
go The player's entity handle.
Definition at line 111 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
setStateFrom()
| inline noexcept |
Updates state from a transition context.
Called by StateManager after a successful transition.
- Template Parameters
-
StateType The state enum type.
- Parameters
-
stateTransitionContext The completed transition context.
Definition at line 141 of file Session.ixx.
Reference helios::engine::runtime::registerComponents.
setViewportHandles()
| inline noexcept |
Replaces the active viewport IDs with the provided list.
- Parameters
-
viewportHandles The new list of active viewport IDs.
Definition at line 205 of file Session.ixx.
References setViewportHandles and viewportHandles.
Referenced by setViewportHandles.
state()
| inline noexcept |
Returns the current state for a given state type.
- Template Parameters
-
StateType The state enum type.
- Returns
The current state, or StateType::Undefined if not found.
Definition at line 156 of file Session.ixx.
References helios::engine::runtime::registerComponents and helios::engine::state::components::StateComponent< StateType >::state.
stateFrom()
| inline noexcept |
Returns the source state of the last transition.
- Template Parameters
-
StateType The state enum type.
- Returns
The state that was transitioned from, or StateType::Undefined if not found.
Definition at line 170 of file Session.ixx.
References helios::engine::state::components::StateComponent< StateType >::from and helios::engine::runtime::registerComponents.
stateTransitionId()
| inline noexcept |
Returns the last transition ID for a given state type.
- Template Parameters
-
StateType The state enum type.
- Returns
The transition ID, or Undefined if not found.
Definition at line 184 of file Session.ixx.
References helios::engine::runtime::registerComponents and helios::engine::state::components::StateComponent< StateType >::transitionId.
trackState()
| inline |
Lets this session track the specified StateType.
- Template Parameters
-
StateType The state enum type.
Definition at line 196 of file Session.ixx.
viewportHandles()
| inline noexcept |
Returns the currently active viewport handles.
- Returns
Read-only span of viewport handles.
Definition at line 214 of file Session.ixx.
Reference viewportHandles.
Referenced by setViewportHandles and viewportHandles.
Private Member Attributes
gameObject_
|
The underlying GameObject storing session components.
Definition at line 68 of file Session.ixx.
playerEntity_
|
Handle to the player entity.
Definition at line 73 of file Session.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.