Session.ixx File
Session state container for game-wide state. More...
Included Headers
#include <optional>
#include <vector>
#include <span>
#include <cassert>
#include <helios.engine.ecs.EntityHandle>
#include <helios.engine.ecs.GameObject>
#include <helios.engine.common.types.ViewportId>
#include <helios.engine.state.components>
#include <helios.engine.state.types>
#include <helios.engine.state.types.StateTransitionId>
#include <helios.engine.mechanics.match.types>
#include <helios.engine.modules.rendering.viewport.components.ActiveViewportIdsStateComponent>
#include <helios.engine.mechanics.gamestate.types>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | runtime |
|
Runtime infrastructure for game execution and lifecycle orchestration. More... | |
| namespace | world |
|
World state management, resource registry, and per-frame update context. More... | |
Classes Index
| class | Session |
|
Holds session-level state for the current game instance. More... | |
Description
Session state container for game-wide state.
File Listing
The file content with the documentation metadata removed is:
30using namespace helios::engine::mechanics::match::types;
31using namespace helios::engine::mechanics::gamestate::types;
33using namespace helios::engine::state::types;
34using namespace helios::engine::state::components;
36using namespace helios::engine::modules::rendering::viewport::components;
38export namespace helios::engine::runtime::world {
67 ecs::GameObject gameObject_;
72 ecs::EntityHandle playerEntity_;
84 explicit Session(const ecs::GameObject go) : gameObject_(go) {
85 gameObject_.add<ActiveViewportIdsStateComponent>();
93 void setPlayerEntityHandle(const ecs::EntityHandle go) noexcept {
102 [[nodiscard]] ecs::EntityHandle playerEntityHandle() const noexcept {
123 void setStateFrom(const StateTransitionContext<StateType> stateTransitionContext) noexcept {
125 if (auto* msc = gameObject_.get<StateComponent<StateType>>()) {
139 auto* sc = gameObject_.get<StateComponent<StateType>>();
141 return sc ? sc->state() : StateType::Undefined;
153 auto* sc = gameObject_.get<StateComponent<StateType>>();
155 return sc ? sc->from() : StateType::Undefined;
166 [[nodiscard]] StateTransitionIdType<StateType> stateTransitionId() const noexcept {
167 auto* ms = gameObject_.get<StateComponent<StateType>>();
169 return ms ? ms->transitionId() : StateTransitionIdType<StateType>::Undefined;
178 void trackState() {
179 gameObject_.getOrAdd<StateComponent<StateType>>();
187 void setViewportIds(std::span<const helios::engine::common::types::ViewportId>& viewportIds) noexcept {
188 gameObject_.get<ActiveViewportIdsStateComponent>()->setViewportIds(viewportIds);
196 [[nodiscard]] std::span<const helios::engine::common::types::ViewportId> viewportIds() const noexcept {
197 return gameObject_.get<ActiveViewportIdsStateComponent>()->viewportIds();
203 void clearViewportIds() noexcept {
204 gameObject_.get<ActiveViewportIdsStateComponent>()->clear();
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.