Skip to main content

Pass Class

Represents a single pass within a game loop phase. More...

Declaration

class helios::engine::runtime::gameloop::Pass { ... }

Friends Index

classhelios::engine::runtime::gameloop::Phase

Public Constructors Index

Pass (Phase &owner)

Constructs a Pass with a reference to its owning Phase. More...

Public Member Functions Index

template <typename T, typename... Args>
Pass &addSystem (Args &&... args)

Adds a system of type T to this pass. More...

Phase &addCommitPoint (const CommitPoint commitPoint=CommitPoint::PassEvents)

Marks this pass with a commit point and returns the owning Phase. More...

CommitPointcommitPoint () const noexcept

Returns the configured commit point for this pass. More...

Private Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext)

Updates all systems registered in this pass. More...

voidinit (helios::engine::runtime::world::GameWorld &gameWorld)

Initializes all systems registered in this pass. More...

Private Member Attributes Index

helios::engine::runtime::world::SystemRegistrysystemRegistry_ {}

Registry holding all systems for this pass. More...

Phase &owner_

Reference to the owning Phase. More...

CommitPointcommitPoint_ = CommitPoint::None

The CommitPoint configured for this Pass. More...

Description

Represents a single pass within a game loop phase.

A Pass contains a registry of systems that are executed sequentially during the game loop update. Passes can be configured with a commit point to synchronize events between passes.

Systems are added to a pass using the fluent `add<T>()` method, and a commit point can be added using `addCommitPoint()`.

Example usage: ```cpp gameLoop.phase(PhaseType::Main) .addPass() .add<MovementSystem>() .add<PhysicsSystem>() .addCommitPoint() .addPass() .add<CollisionSystem>(); ```

See Also

Phase

See Also

System

Definition at line 52 of file Pass.ixx.

Friends

helios::engine::runtime::gameloop::Phase

Definition at line 54 of file Pass.ixx.

Referenced by addCommitPoint and Pass.

Public Constructors

Pass()

helios::engine::runtime::gameloop::Pass::Pass (Phase & owner)
inline explicit

Constructs a Pass with a reference to its owning Phase.

Parameters
owner

Reference to the parent Phase.

Definition at line 102 of file Pass.ixx.

102 explicit Pass(
103 Phase& owner
104 ) : owner_(owner) {}

Reference helios::engine::runtime::gameloop::Phase.

Referenced by addSystem.

Public Member Functions

addCommitPoint()

Phase & helios::engine::runtime::gameloop::Pass::addCommitPoint (const CommitPoint commitPoint=CommitPoint::PassEvents)
inline

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

CommitPoint

See Also

UpdateContext::pushPass()

See Also

UpdateContext::readPass()

See Also

GameLoop::passCommit()

Definition at line 151 of file Pass.ixx.

152 commitPoint_ = commitPoint;
153 return owner_;
154 }

References commitPoint, helios::engine::runtime::gameloop::Phase and helios::engine::runtime::gameloop::PassEvents.

addSystem()

template <typename T, typename... Args>
Pass & helios::engine::runtime::gameloop::Pass::addSystem (Args &&... args)
inline

Adds a system of type T to this pass.

Template Parameters
T

The system type to add. Must derive from System.

Args

Constructor argument types for the system.

Parameters
args

Arguments forwarded to the system constructor.

Returns

Reference to this Pass for method chaining.

Definition at line 118 of file Pass.ixx.

118 Pass& addSystem(Args&&... args) {
119 systemRegistry_.add<T>(std::forward<Args>(args)...);
120
121 return *this;
122 }

Reference Pass.

commitPoint()

CommitPoint helios::engine::runtime::gameloop::Pass::commitPoint ()
inline nodiscard noexcept

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

CommitPoint

See Also

addCommitPoint()

Definition at line 168 of file Pass.ixx.

168 [[nodiscard]] CommitPoint commitPoint() const noexcept {
169 return commitPoint_;
170 }

Referenced by addCommitPoint.

Private Member Functions

init()

void helios::engine::runtime::gameloop::Pass::init (helios::engine::runtime::world::GameWorld & gameWorld)
inline

Initializes all systems registered in this pass.

Parameters
gameWorld

Reference to the game world.

Definition at line 83 of file Pass.ixx.

84 for (auto& sys : systemRegistry_.systems()) {
85 sys->init(gameWorld);
86 }
87 }

update()

void helios::engine::runtime::gameloop::Pass::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline

Updates all systems registered in this pass.

Parameters
updateContext

The current update context.

Definition at line 71 of file Pass.ixx.

71 void update(helios::engine::runtime::world::UpdateContext& updateContext) {
72 for (auto& sys : systemRegistry_.systems()) {
73 sys->update(updateContext);
74 }
75 }

Private Member Attributes

commitPoint_

CommitPoint helios::engine::runtime::gameloop::Pass::commitPoint_ = CommitPoint::None

The CommitPoint configured for this Pass.

Definition at line 93 of file Pass.ixx.

93 CommitPoint commitPoint_ = CommitPoint::None;

owner_

Phase& helios::engine::runtime::gameloop::Pass::owner_

Reference to the owning Phase.

Definition at line 64 of file Pass.ixx.

64 Phase& owner_;

systemRegistry_

helios::engine::runtime::world::SystemRegistry helios::engine::runtime::gameloop::Pass::systemRegistry_ {}

Registry holding all systems for this pass.

Definition at line 59 of file Pass.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.