Phase Class
Represents a phase in the game loop containing multiple passes. More...
Declaration
Friends Index
| class | helios::engine::runtime::gameloop::GameLoop |
Public Constructors Index
| Phase (helios::engine::runtime::gameloop::GameLoop &gameloop, GameWorld &gameWorld) | |
|
Constructs a Phase with references to GameLoop and GameWorld. More... | |
Public Member Functions Index
| bool | addPassCommitListener (PassCommitListener *passCommitListener) |
|
Registers a listener to be notified when passes commit. More... | |
template <typename StateType> | |
| Pass & | addPass (const StateType t) |
|
Creates and adds a new typed pass to this phase. More... | |
| helios::engine::runtime::gameloop::GameLoop & | gameLoop () noexcept |
Private Member Functions Index
| void | init (GameWorld &gameWorld) |
|
Initializes all passes within this phase. More... | |
| void | update (GameWorld &gameWorld, UpdateContext &updateContext) |
|
Updates all passes within this phase. More... | |
| bool | notifyPassCommitListeners (CommitPoint commitPoint, GameWorld &gameWorld, UpdateContext &updateContext) |
|
Notifies all registered listeners about a pass commit. More... | |
Private Member Attributes Index
| std::vector< PassCommitListener * > | passCommitListeners_ |
|
Collection of listeners to be notified when a pass commits. More... | |
| std::vector< std::unique_ptr< Pass > > | passEntries_ |
|
Collection of passes belonging to this phase. More... | |
| helios::engine::runtime::gameloop::GameLoop & | gameloop_ |
| helios::engine::runtime::world::GameWorld & | gameWorld_ |
Description
Represents a phase in the game loop containing multiple passes.
A Phase groups related systems into passes that are executed sequentially. Each pass can contain multiple systems and may have a commit point for event synchronization.
Commit points allow fine-grained control over when commands are flushed, managers are processed, and pass-level events are synchronized. See CommitPoint for available synchronization options.
Phases are owned by the GameLoop and should not be created directly.
- See Also
- See Also
- See Also
Definition at line 74 of file Phase.ixx.
Friends
helios::engine::runtime::gameloop::GameLoop
Definition at line 76 of file Phase.ixx.
Public Constructors
Phase()
| inline explicit |
Constructs a Phase with references to GameLoop and GameWorld.
- Parameters
-
gameloop Reference to the parent GameLoop.
gameWorld Shared GameWorld used by passes in this phase.
Definition at line 180 of file Phase.ixx.
Public Member Functions
addPass()
| inline |
Creates and adds a new typed pass to this phase.
The state parameter specifies in which states this pass should execute. Passes are skipped if the current state does not match the configured mask (using bitwise AND). New passes are bound to this phase's GameWorld reference.
- Template Parameters
-
StateType The state enum type (e.g., GameState, MatchState).
- Parameters
-
t The state mask specifying when this pass should run.
- Returns
Reference to the newly created Pass for method chaining.
- See Also
- See Also
Definition at line 234 of file Phase.ixx.
Reference helios::engine::runtime::registerComponents.
addPassCommitListener()
| inline |
Registers a listener to be notified when passes commit.
The listener will receive notifications for all passes within this phase. The GameLoop typically registers itself to handle event synchronization, command buffer flushing, and manager processing based on commit point flags.
Duplicate registrations are prevented; attempting to add the same listener twice will return false and leave the listener list unchanged.
- Parameters
-
passCommitListener Pointer to the listener to register. Must remain valid for the lifetime of this Phase or until removed.
- Returns
True if the listener was added, false if it was already registered.
- See Also
- See Also
notifyPassCommitListeners()
Definition at line 203 of file Phase.ixx.
Reference helios::engine::runtime::registerComponents.
Referenced by helios::engine::runtime::gameloop::GameLoop::init.
gameLoop()
| inline noexcept |
Private Member Functions
init()
| inline |
Initializes all passes within this phase.
- Parameters
-
gameWorld Reference to the game world.
notifyPassCommitListeners()
| inline |
Notifies all registered listeners about a pass commit.
Called after each pass completes its update cycle. Each registered PassCommitListener receives the commit point flags, allowing it to perform the appropriate synchronization actions (event swapping, command flushing, manager processing).
- Parameters
-
commitPoint The CommitPoint flags from the completed pass.
gameWorld The game world where the commit occured.
updateContext The current update context.
- Returns
Always returns true.
- See Also
- See Also
Definition at line 152 of file Phase.ixx.
update()
| inline |
Updates all passes within this phase.
Iterates through all passes, updating their systems and then invoking the commit action based on the pass's configured CommitPoint. The commit point determines whether pass-level events are synchronized, the command buffer is flushed, or managers are processed.
Passes are conditionally executed based on their configured game state. A pass is only updated if its runsIn() state matches the current game state.
- Parameters
-
gameWorld The game world where the update occurred.
updateContext The current update context.
- See Also
- See Also
- See Also
Pass::runsIn()
Definition at line 123 of file Phase.ixx.
Private Member Attributes
gameloop_
|
Reference to the owning GameLoop.
Definition at line 168 of file Phase.ixx.
gameWorld_
|
Definition at line 170 of file Phase.ixx.
passCommitListeners_
|
Collection of listeners to be notified when a pass commits.
Listeners are notified after each pass completes, receiving the pass's configured CommitPoint flags. The GameLoop registers itself as a listener to handle event buffer swapping, command flushing, and manager processing based on the commit point configuration.
- See Also
- See Also
notifyPassCommitListeners()
Definition at line 89 of file Phase.ixx.
passEntries_
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.