Skip to main content

bootstrap.ixx File

Engine bootstrap: component registration and GameWorld/GameLoop factory. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespacebootstrap

Classes Index

structComponentRegistrar<std::tuple< TEntityManagers... >>

Description

Engine bootstrap: component registration and GameWorld/GameLoop factory.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <cassert>
8#include <cstddef>
10#include <memory>
11#include <utility>
12
13export module helios.engine.bootstrap;
14
15import helios.engine.runtime.gameloop;
16import helios.engine.runtime.world;
17
18import helios.engine.state.types.StateTransitionContext;
19import helios.engine.runtime.messaging.command;
20
21import helios.engine.runtime.world.types.GameObjectHandle;
22
23import helios.engine.platform;
24
25import helios.engine.scene.registry;
26import helios.engine.spatial.registry;
27import helios.engine.scene.registry;
28
29import helios.engine.rendering.registry;
30import helios.engine.rendering.RenderManager;
31import helios.engine.runtime.registry;
32
33import helios.engine.runtime.lifecycle;
34import helios.engine.runtime.timing;
35import helios.engine.runtime.enginestate;
36
37using namespace helios::engine::state::types;
45
46export namespace helios::engine::bootstrap {
47
48 template<typename... Tuple>
50
51 template<typename... TEntityManagers>
52 struct ComponentRegistrar<std::tuple<TEntityManagers...>> {
53 static void registerComponents() {
58 }
59
60 };
61
62
83 inline void registerAllComponents() {
84
85 static bool done = false;
86 if (done) {
87 return;
88 }
89 done = true;
90
92
93 }
94
146 inline std::pair<std::unique_ptr<GameWorld>, std::unique_ptr<GameLoop>> bootstrapGameWorld(
148 ) {
149 auto gameWorld = std::make_unique<helios::engine::runtime::world::GameWorld>(capacity);
150
151 auto gameLoop = std::make_unique<helios::engine::runtime::gameloop::GameLoop>(*gameWorld);
152
153
155
156 // managers
158
161
162 gameWorld->registerManager<helios::engine::runtime::timing::TimerManager>();
163
164 gameWorld->session().trackState<helios::engine::runtime::enginestate::types::EngineState>();
165
166 gameWorld->registerCommandBuffer<RenderCommandBuffer>();
167 gameWorld->registerCommandBuffer<PlatformCommandBuffer>();
168 gameWorld->registerCommandBuffer<EngineCommandBuffer>();
169
170 gameWorld->session().setStateFrom<EngineState>(
172 EngineState::Undefined,
173 EngineState::Booting,
174 EngineStateTransitionId::BootRequest
175 ));
176
177
178 return std::make_pair(std::move(gameWorld), std::move(gameLoop));
179 }
180
181}
182

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.