TypedPass Class Template
State-filtered pass that only executes in specific states. More...
Declaration
Base class
| class | Pass |
|
Abstract base class for game loop passes. More... | |
Friends Index
template <typename StateType> | |
| class | helios::engine::runtime::gameloop::Phase |
Public Constructors Index
template <typename StateType> | |
| TypedPass (Phase &owner, const StateType mask) | |
|
Constructs a Pass with a reference to its owning Phase. More... | |
Public Member Functions Index
template <typename StateType> | |
| Phase & | addCommitPoint (const CommitPoint commitPoint=CommitPoint::PassEvents) override |
|
Marks this pass with a commit point and returns the owning Phase. More... | |
template <typename StateType> | |
| CommitPoint | commitPoint () const noexcept override |
|
Returns the configured commit point for this pass. More... | |
template <typename StateType> | |
| bool | shouldRun (helios::engine::runtime::world::UpdateContext &updateContext) const noexcept override |
|
Checks if this pass should execute based on current state. More... | |
template <typename StateType> | |
| bool | hasFlag (StateType mask, StateType value) const noexcept |
|
Checks if a value has any bit set in the mask. More... | |
Private Member Functions Index
template <typename StateType> | |
| void | update (helios::engine::runtime::world::UpdateContext &updateContext) override |
|
Updates all systems registered in this pass. More... | |
template <typename StateType> | |
| void | init (helios::engine::runtime::world::GameWorld &gameWorld) override |
|
Initializes all systems registered in this pass. More... | |
Private Member Attributes Index
template <typename StateType> | |
| Phase & | owner_ |
template <typename StateType> | |
| StateType | mask_ |
|
Bitmask of states in which this pass should execute. More... | |
template <typename StateType> | |
| CommitPoint | commitPoint_ = CommitPoint::None |
|
The CommitPoint configured for this Pass. More... | |
Description
State-filtered pass that only executes in specific states.
TypedPass extends the base Pass class with state-based filtering. The pass only executes when the current state (queried from Session) matches the configured state mask using bitwise AND.
## State Filtering
The state mask is a bitfield where each bit represents a state value. A pass runs if any bit in the mask matches the current state:
```cpp // Run only in Running state phase.addPass<GameState>(GameState::Running) .addSystem<MovementSystem>();
// Run in multiple states (bitwise OR) phase.addPass<GameState>(GameState::Running | GameState::Paused) .addSystem<InputSystem>(); ```
- Template Parameters
-
StateType The state enum type (e.g., GameState, MatchState).
- See Also
- See Also
- See Also
Session::state()
Definition at line 60 of file TypedPass.ixx.
Friends
helios::engine::runtime::gameloop::Phase
|
Definition at line 62 of file TypedPass.ixx.
References helios::engine::runtime::gameloop::TypedPass< StateType >::helios::engine::runtime::gameloop::Phase and helios::engine::runtime::gameloop::Pass::systemRegistry_.
Referenced by helios::engine::runtime::gameloop::TypedPass< StateType >::addCommitPoint, helios::engine::runtime::gameloop::TypedPass< StateType >::helios::engine::runtime::gameloop::Phase and helios::engine::runtime::gameloop::TypedPass< StateType >::TypedPass.
Public Constructors
TypedPass()
| inline explicit |
Constructs a Pass with a reference to its owning Phase.
- Parameters
-
owner Reference to the parent Phase.
Definition at line 112 of file TypedPass.ixx.
Reference helios::engine::runtime::gameloop::TypedPass< StateType >::helios::engine::runtime::gameloop::Phase.
Public Member Functions
addCommitPoint()
| inline virtual |
Marks this pass with a commit point and returns the owning Phase.
When a commit point is set, the specified synchronization actions are performed after this pass completes. The default is `CommitPoint::PassEvents` which only synchronizes pass-level events.
Available CommitPoint flags:
- `PassEvents` - Events pushed via `UpdateContext::pushPass()` become readable.
- `FlushCommands` - Pending commands from the CommandBuffer are executed.
- `FlushManagers` - Managers process their queued requests.
- `Structural` - Combines all three flags.
Flags can be combined using bitwise OR: ```cpp pass.addCommitPoint(CommitPoint::PassEvents | CommitPoint::FlushCommands); ```
- Parameters
-
commitPoint The flags specifying which actions to perform (default: PassEvents).
- Returns
Reference to the owning Phase for continued configuration.
- See Also
- See Also
UpdateContext::pushPass()
- See Also
UpdateContext::readPass()
- See Also
GameLoop::passCommit()
Definition at line 142 of file TypedPass.ixx.
References helios::engine::runtime::gameloop::TypedPass< StateType >::commitPoint, helios::engine::runtime::gameloop::TypedPass< StateType >::helios::engine::runtime::gameloop::Phase and helios::engine::runtime::gameloop::PassEvents.
commitPoint()
| inline nodiscard noexcept virtual |
Returns the configured commit point for this pass.
The commit point determines what synchronization actions are performed after this pass completes. If no commit point was added, returns CommitPoint::None.
- Returns
The commit point flags for this pass.
- See Also
- See Also
Definition at line 159 of file TypedPass.ixx.
Referenced by helios::engine::runtime::gameloop::TypedPass< StateType >::addCommitPoint.
hasFlag()
| inline noexcept |
Checks if a value has any bit set in the mask.
- Parameters
-
mask The bitmask to check against.
value The value to test.
- Returns
True if any bit in mask matches value.
Definition at line 187 of file TypedPass.ixx.
Referenced by helios::engine::runtime::gameloop::TypedPass< StateType >::shouldRun.
shouldRun()
| inline nodiscard noexcept virtual |
Checks if this pass should execute based on current state.
Queries the current state from the Session and compares it against the configured mask using bitwise AND. The pass runs if any bit in the mask matches the current state.
- Parameters
-
updateContext The current update context.
- Returns
True if the pass should execute.
Definition at line 174 of file TypedPass.ixx.
References helios::engine::runtime::gameloop::TypedPass< StateType >::hasFlag, helios::engine::runtime::world::UpdateContext::session and helios::engine::runtime::world::Session::state.
Private Member Functions
init()
| inline virtual |
Initializes all systems registered in this pass.
- Parameters
-
gameWorld Reference to the game world.
Definition at line 91 of file TypedPass.ixx.
update()
| inline virtual |
Updates all systems registered in this pass.
- Parameters
-
updateContext The current update context.
Definition at line 79 of file TypedPass.ixx.
Private Member Attributes
commitPoint_
|
The CommitPoint configured for this Pass.
Definition at line 101 of file TypedPass.ixx.
mask_
|
Bitmask of states in which this pass should execute.
Definition at line 72 of file TypedPass.ixx.
owner_
|
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.