Session Class
Holds session-level state for the current game instance. More...
Declaration
Public Constructors Index
| Session (const ecs::GameObject go) | |
|
Constructs a session with the given GameObject. More... | |
Public Member Functions Index
| void | setPlayerEntityHandle (const ecs::EntityHandle go) noexcept |
|
Sets the player entity handle. More... | |
| ecs::EntityHandle | 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 | setViewportIds (std::span< const helios::engine::common::types::ViewportId > &viewportIds) noexcept |
|
Replaces the active viewport IDs with the provided list. More... | |
| std::span< const helios::engine::common::types::ViewportId > | viewportIds () const noexcept |
|
Returns the currently active viewport IDs. More... | |
| void | clearViewportIds () noexcept |
|
Clears all active viewport IDs. More... | |
Private Member Attributes Index
| ecs::GameObject | gameObject_ |
|
The underlying GameObject storing session components. More... | |
| ecs::EntityHandle | 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:
```cpp session.trackState<GameState>(); session.trackState<MatchState>(); ```
## Stored Components
- `StateComponent<T>` - Registered via trackState<T>()
- `ActiveViewportIdsStateComponent` - Active viewport list (auto-added)
- See Also
- See Also
StateManager
Definition at line 62 of file Session.ixx.
Public Constructors
Session()
| inline explicit |
Constructs a session with the given GameObject.
Automatically adds ActiveViewportIdsStateComponent. State types must be registered separately via trackState<T>().
- Parameters
-
go The GameObject to use as the session entity.
Definition at line 84 of file Session.ixx.
Public Member Functions
clearViewportIds()
| inline noexcept |
Clears all active viewport IDs.
Definition at line 203 of file Session.ixx.
playerEntityHandle()
| inline nodiscard noexcept |
Returns the player entity handle.
- Returns
The player's entity handle.
Definition at line 102 of file Session.ixx.
Referenced by helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards::hasLifeLeft, helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards::isPlayerActive and helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards::isPlayerInactive.
reset()
| inline |
setPlayerEntityHandle()
| inline noexcept |
Sets the player entity handle.
- Parameters
-
go The player's entity handle.
Definition at line 93 of file Session.ixx.
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 123 of file Session.ixx.
setViewportIds()
| inline noexcept |
Replaces the active viewport IDs with the provided list.
- Parameters
-
viewportIds The new list of active viewport IDs.
Definition at line 187 of file Session.ixx.
References setViewportIds and viewportIds.
Referenced by setViewportIds.
state()
| inline nodiscard 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 138 of file Session.ixx.
Reference helios::engine::state::components::StateComponent< StateType >::state.
Referenced by helios::engine::state::StateManager< types::GameState >::flush and helios::engine::runtime::gameloop::TypedPass< StateType >::shouldRun.
stateFrom()
| inline nodiscard 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 152 of file Session.ixx.
Reference helios::engine::state::components::StateComponent< StateType >::from.
stateTransitionId()
| inline nodiscard 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 166 of file Session.ixx.
Reference 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 178 of file Session.ixx.
viewportIds()
| inline nodiscard noexcept |
Returns the currently active viewport IDs.
- Returns
Read-only span of viewport identifiers.
Definition at line 196 of file Session.ixx.
Reference viewportIds.
Referenced by setViewportIds and viewportIds.
Private Member Attributes
gameObject_
|
The underlying GameObject storing session components.
Definition at line 67 of file Session.ixx.
playerEntity_
|
Handle to the player entity.
Definition at line 72 of file Session.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.