Skip to main content

Pass.ixx File

Abstract base class for game loop passes. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespaceworld

World state management, resource registry, and per-frame update context. More...

namespacegameloop

Central game loop orchestration module. More...

Classes Index

classPass

Abstract base class for game loop passes. More...

Description

Abstract base class for game loop passes.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Pass.ixx
3 * @brief Abstract base class for game loop passes.
4 */
5module;
6
7#include <type_traits>
8#include <utility>
9#include <memory>
10
11export module helios.engine.runtime.gameloop.Pass;
12
13import helios.engine.runtime.gameloop.CommitPoint;
14
15
16import helios.engine.runtime.world.SystemRegistry;
17import helios.engine.common.concepts;
18
19
20import helios.engine.runtime.world.UpdateContext;
21
22import helios.engine.mechanics.gamestate.types;
23
24export namespace helios::engine::runtime::world {
25 class GameWorld;
26}
27
29
30 class Phase;
31
32 /**
33 * @brief Abstract base class for game loop passes.
34 *
35 * @details A Pass represents a logical grouping of systems executed
36 * sequentially within a Phase. Concrete implementations (TypedPass)
37 * add state-based filtering via shouldRun().
38 *
39 * ## Key Features
40 *
41 * - **System Registration:** Systems are added via addSystem<T>()
42 * - **Commit Points:** Control when events/commands are synchronized
43 * - **State Filtering:** Passes can be skipped based on game state
44 *
45 * @see TypedPass
46 * @see Phase
47 * @see System
48 */
49 class Pass {
50
51 protected:
52 /**
53 * @brief Registry holding all systems for this pass.
54 */
56
57 public:
58 virtual ~Pass() = default;
59
60 /**
61 * @brief Updates all systems in this pass.
62 *
63 * @param updateContext The current update context.
64 */
65 virtual void update(helios::engine::runtime::world::UpdateContext& updateContext) = 0;
66
67 /**
68 * @brief Initializes all systems in this pass.
69 *
70 * @param gameWorld Reference to the game world.
71 */
72 virtual void init(helios::engine::runtime::world::GameWorld& gameWorld) = 0;
73
74 /**
75 * @brief Adds a commit point and returns the owning Phase.
76 *
77 * @param commitPoint The synchronization flags.
78 *
79 * @return Reference to the owning Phase.
80 */
82
83 /**
84 * @brief Returns the configured commit point.
85 *
86 * @return The commit point flags for this pass.
87 */
88 virtual CommitPoint commitPoint() const noexcept = 0;
89
90 /**
91 * @brief Determines if this pass should execute.
92 *
93 * @param updateContext The current update context.
94 *
95 * @return True if the pass should run.
96 */
97 virtual bool shouldRun(helios::engine::runtime::world::UpdateContext& updateContext) const noexcept = 0;
98
99 /**
100 * @brief Adds a system of type T to this pass.
101 *
102 * @tparam T The system type to add.
103 * @tparam Args Constructor argument types for the system.
104 *
105 * @param args Arguments forwarded to the system constructor.
106 *
107 * @return Reference to this Pass for method chaining.
108 */
109 template<typename T, typename... Args>
110 requires helios::engine::common::concepts::IsSystemLike<T>
111 Pass& addSystem(Args&&... args) {
112 systemRegistry_.template add<T>(
113 std::forward<Args>(args)...
114 );
115
116 return *this;
117 }
118 };
119
120}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.