Skip to main content

StateToViewportPolicyUpdateSystem Class Template

Updates the session's active viewport list based on state policy. More...

Declaration

template <typename StateLft, typename StateRgt> class helios::engine::modules::rendering::viewport::systems::StateToViewportPolicyUpdateSystem<StateLft, StateRgt> { ... }

Public Member Typedefs Index

template <typename StateLft, typename StateRgt>
usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

template <typename StateLft, typename StateRgt>
StateToViewportPolicyUpdateSystem (StateToIdMapPair< StateLft, StateRgt, ViewportId > stateToIdMapPair)

Constructs the system with a state-to-ID map pair. More...

Public Member Functions Index

template <typename StateLft, typename StateRgt>
voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Updates the session's active viewport IDs. More...

Private Member Attributes Index

template <typename StateLft, typename StateRgt>
StateToIdMapPair< StateLft, StateRgt, ViewportId >stateToIdMapPair_

Policy defining viewport-to-state mappings. More...

Description

Updates the session's active viewport list based on state policy.

Queries the current states from the session using the configured template parameters, then uses StateToIdMapPair to determine which viewports should be active. The resulting viewport IDs are stored in the session for use by the rendering system.

## Usage

```cpp StateToIdMapPair<GameState, MatchState, ViewportId> policy; policy.add(GameState::Running, ViewportId("game")); policy.add(MatchState::GameOver, ViewportId("game_over")); policy.freeze();

gameLoop.phase(PhaseType::Pre) .addPass<GameState>(GameState::Any) .addSystem<StateToViewportPolicyUpdateSystem<GameState, MatchState>>( std::move(policy) ); ```

Template Parameters
StateLft

The left/primary state type (e.g., GameState).

StateRgt

The right/secondary state type (e.g., MatchState).

See Also

StateToIdMapPair

See Also

Session

Definition at line 60 of file StateToViewportPolicyUpdateSystem.ixx.

Public Member Typedefs

EngineRoleTag

template <typename StateLft, typename StateRgt>
using helios::engine::modules::rendering::viewport::systems::StateToViewportPolicyUpdateSystem< StateLft, StateRgt >::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

StateToViewportPolicyUpdateSystem()

template <typename StateLft, typename StateRgt>
helios::engine::modules::rendering::viewport::systems::StateToViewportPolicyUpdateSystem< StateLft, StateRgt >::StateToViewportPolicyUpdateSystem (StateToIdMapPair< StateLft, StateRgt, ViewportId > stateToIdMapPair)
inline explicit

Constructs the system with a state-to-ID map pair.

Parameters
stateToIdMapPair

Policy mapping states to viewport IDs.

Definition at line 76 of file StateToViewportPolicyUpdateSystem.ixx.

77 : stateToIdMapPair_(std::move(stateToIdMapPair)){}

Public Member Functions

update()

template <typename StateLft, typename StateRgt>
void helios::engine::modules::rendering::viewport::systems::StateToViewportPolicyUpdateSystem< StateLft, StateRgt >::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Updates the session's active viewport IDs.

Clears the current viewport IDs and sets them based on the current game and match state combination.

Parameters
updateContext

The current frame's update context.

Definition at line 87 of file StateToViewportPolicyUpdateSystem.ixx.

88
89 auto& session = updateContext.session();
90
91 auto gameState = session.state<StateLft>();
92 auto matchState = session.state<StateRgt>();
93
94 session.clearViewportIds();
95
96 auto viewportIds = stateToIdMapPair_.ids(gameState, matchState);
97 session.setViewportIds(viewportIds);
98
99
100
101
102 }

Private Member Attributes

stateToIdMapPair_

template <typename StateLft, typename StateRgt>
StateToIdMapPair<StateLft, StateRgt, ViewportId> helios::engine::modules::rendering::viewport::systems::StateToViewportPolicyUpdateSystem< StateLft, StateRgt >::stateToIdMapPair_

Policy defining viewport-to-state mappings.

Definition at line 65 of file StateToViewportPolicyUpdateSystem.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.