Skip to main content

TypedPass.ixx File

State-filtered pass implementation for game loop phases. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespacegameloop

Classes Index

classTypedPass<StateType>

State-filtered pass that only executes in specific states. More...

Description

State-filtered pass implementation for game loop phases.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <type_traits>
8#include <utility>
9
10export module helios.engine.runtime.gameloop:TypedPass;
11
12import :CommitPoint;
13import :Pass;
14
15import helios.engine.runtime.world.SystemRegistry;
16
17import helios.engine.runtime.world.UpdateContext;
18import helios.engine.runtime.world.Session;
19
20import helios.engine.runtime.enginestate.types;
21
23
24 class Phase;
25
54 template<typename StateType>
55 class TypedPass : public Pass {
56
58
62 Phase& owner_;
63
67 StateType mask_;
68
75 for (auto& sys : systemRegistry_.items()) {
76 sys->update(updateContext);
77 }
78 }
79
80
86 void init(helios::engine::runtime::world::GameWorld& gameWorld) override {
87
88 }
89
90
94 CommitPoint commitPoint_ = CommitPoint::None;
95
96
97
98 public:
99
107 explicit TypedPass(Phase& owner, const StateType mask, helios::engine::runtime::world::GameWorld& gameWorld) : owner_(owner), mask_(mask), Pass(gameWorld) {}
108
109
138 commitPoint_ = commitPoint;
139 return owner_;
140 }
141
142
155 return commitPoint_;
156 }
157
170 auto state = updateContext.session().state<StateType>();
171 return hasFlag(mask_, state);
172 }
173
182 bool hasFlag(StateType mask, StateType value) const noexcept {
183 using U = std::underlying_type_t<StateType>;
184 return (static_cast<U>(mask) & static_cast<U>(value)) != 0;
185 }
186
187
188 };
189
190}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.