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;
22import helios.engine.runtime.world.EntityMutationManager;
23
24import helios.engine.platform;
25
26import helios.engine.scene.registry;
27import helios.engine.core.registry;
28import helios.engine.core.thread;
29import helios.engine.spatial.registry;
30import helios.engine.scene.registry;
31
32import helios.engine.rendering.registry;
33import helios.engine.rendering.RenderManager;
34import helios.engine.runtime.registry;
35
36import helios.engine.runtime.lifecycle;
37import helios.engine.runtime.timing;
38import helios.engine.runtime.enginestate;
39
40using namespace helios::engine::core::thread;
41using namespace helios::engine::state::types;
49
50export namespace helios::engine::bootstrap {
51
52 template<typename... Tuple>
54
55 template<typename... TEntityManagers>
56 struct ComponentRegistrar<std::tuple<TEntityManagers...>> {
57 static void registerComponents() {
63 }
64
65 };
66
67
88 inline void registerAllComponents() {
89
90 static bool done = false;
91 if (done) {
92 return;
93 }
94 done = true;
95
97
98 }
99
152 inline std::pair<std::unique_ptr<GameWorld>, std::unique_ptr<GameLoop>> bootstrapGameWorld(
153 JobSystem& jobSystem,
155 ) {
156 auto gameWorld = std::make_unique<helios::engine::runtime::world::GameWorld>(jobSystem, capacity);
157
158 auto gameLoop = std::make_unique<helios::engine::runtime::gameloop::GameLoop>(*gameWorld);
159
160
162
163 // managers
165
168
169 gameWorld->registerManager<helios::engine::runtime::timing::TimerManager>();
171 gameWorld->entityManager<GameObjectHandle>(),
172 jobSystem
173 );
174
175 gameWorld->session().trackState<helios::engine::runtime::enginestate::types::EngineState>();
176
177 gameWorld->registerCommandBuffer<RenderCommandBuffer>();
178 gameWorld->registerCommandBuffer<PlatformCommandBuffer>();
179 gameWorld->registerCommandBuffer<EngineCommandBuffer>();
180 gameWorld->registerCommandBuffer<EntityMutationCommandBuffer<GameObjectEntityManager>>();
181
182 gameWorld->session().setStateFrom<EngineState>(
184 EngineState::Undefined,
185 EngineState::Booting,
186 EngineStateTransitionId::BootRequest
187 ));
188
189
190 return std::make_pair(std::move(gameWorld), std::move(gameLoop));
191 }
192
193}
194

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.