Skip to main content

EngineFlowSystem.ixx File

System that drives the high-level game state flow. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespaceenginestate
namespacesystems

Classes Index

classEngineFlowSystem<TCommandBuffer>

System that drives automatic game state transitions. More...

Description

System that drives the high-level game state flow.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7export module helios.engine.runtime.enginestate.systems.EngineFlowSystem;
8
9import helios.engine.runtime.enginestate.types;
10
11import helios.engine.runtime.messaging.command.concepts;
12
13import helios.engine.state.commands;
14import helios.engine.state.types.StateTransitionRequest;
15import helios.engine.state.types.StateTransitionId;
16import helios.engine.runtime.enginestate.EngineStateBindings;
17
18import helios.engine.runtime.enginestate.types;
19
20import helios.ecs;
21import helios.engine.runtime.world.UpdateContext;
22import helios.engine.runtime.world.Session;
23
24import helios.engine.runtime.world.tags.SystemRole;
25
27using namespace helios::engine::runtime::messaging::command::concepts;
28using namespace helios::engine::state::types;
32
46 template<typename TCommandBuffer>
49
53 EngineState prevMatchState_ = EngineState::Undefined;
54
59
60 public:
61
63
65
76
77 auto& session = updateContext.session();
78
79 const auto engineState = session.state<EngineState>();
80 auto engineStateTransitionId = session.stateTransitionId<EngineState>();
81
82 // only return if the state is undefined.
83 // in any other case, we allow to drive the state forward, even if
84 // the previous state is the same as the current one, in case any guard
85 // did veto the next state
86 if (engineState == EngineState::Undefined) {// && prevMatchState_ == engineState && prevEngineStateTransitionId_ == engineStateTransitionId) {
87 return;
88 }
89
90 prevMatchState_= engineState;
91 prevEngineStateTransitionId_ = engineStateTransitionId;
92
93 switch (engineState) {
94 case EngineState::Booting: {
95 buffer.template add<StateCommand<EngineState>>(
96 StateTransitionRequest<EngineState>(engineState, EngineStateTransitionId::BootRequest)
97 );
98 break;
99 }
100
101 case EngineState::Booted: {
102 buffer.template add<StateCommand<EngineState>>(
103 StateTransitionRequest<EngineState>(engineState, EngineStateTransitionId::WarmupRequest)
104 );
105 break;
106 }
107
108
109 default:
110 break;
111 }
112 }
113 };
114}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.