@@ -28,22 +28,28 @@ namespace NovelRT::Ecs
28
28
29
29
inline void AddDefaultComponentsAndSystems (SystemScheduler& target)
30
30
{
31
- target.GetComponentCache ().RegisterComponentType (Graphics::RenderComponent{0 , 0 , 0 , 0 , true });
31
+ target.GetComponentCache ().RegisterComponentType (Graphics::RenderComponent{0 , 0 , 0 , 0 , true },
32
+ " NovelRT::Ecs::Graphics::RenderComponent" );
32
33
33
- target.GetComponentCache ().RegisterComponentType (EntityGraphComponent{
34
- false , std::numeric_limits<EntityId>::max (), std::numeric_limits<EntityId>::max ()});
34
+ target.GetComponentCache ().RegisterComponentType (
35
+ EntityGraphComponent{false , std::numeric_limits<EntityId>::max (), std::numeric_limits<EntityId>::max ()},
36
+ " NovelRT::Ecs::EntityGraphComponent" );
35
37
36
- target.GetComponentCache ().RegisterComponentType (LinkedEntityListNodeComponent{
37
- false , std::numeric_limits<EntityId>::max (), std::numeric_limits<EntityId>::max ()});
38
+ target.GetComponentCache ().RegisterComponentType (
39
+ LinkedEntityListNodeComponent{false , std::numeric_limits<EntityId>::max (),
40
+ std::numeric_limits<EntityId>::max ()},
41
+ " NovelRT::Ecs::LinkedEntityListNodeComponent" );
38
42
39
43
target.GetComponentCache ().RegisterComponentType (
40
- TransformComponent{Maths::GeoVector3F::uniform (NAN), Maths::GeoVector2F::uniform (NAN), NAN});
44
+ TransformComponent{Maths::GeoVector3F::uniform (NAN), Maths::GeoVector2F::uniform (NAN), NAN},
45
+ " NovelRT::Ecs::TransformComponent" );
41
46
42
47
target.RegisterSystem (std::make_shared<Ecs::Graphics::DefaultRenderingSystem>(
43
48
_graphicsPluginProvider, _windowingPluginProvider, _resourceManagementPluginProvider));
44
49
45
50
target.GetComponentCache ().RegisterComponentType (
46
- Ecs::Input::InputEventComponent{0 , NovelRT::Input::KeyState::Idle, 0 , 0 });
51
+ Input::InputEventComponent{0 , NovelRT::Input::KeyState::Idle, 0 , 0 },
52
+ " NovelRT::Ecs::Input::InputEventComponent" );
47
53
48
54
target.RegisterSystem (
49
55
std::make_shared<Ecs::Input::InputSystem>(_windowingPluginProvider, _inputPluginProvider));
@@ -179,12 +185,14 @@ namespace NovelRT::Ecs
179
185
* This is the final method you should call to obtain the ECS instance.
180
186
*
181
187
* @tparam TComponentTypes List of component types to register with this ECS instance.
182
- * @param deleteInstructionStates The state of the given component type that signals this component is to be
183
- * deleted to the ECS.
188
+ * @tparam Names List of the names to used for type serialisation.
189
+ * @param deleteInstructionStatesAndSerialisedTypeNames The state of the given component type that signals this
190
+ * component is to be, accompanied by the serialised type name. deleted to the ECS.
184
191
* @returns An instance of the ECS SystemScheduler root object based on the provided configuration.
185
192
*/
186
193
template <typename ... TComponentTypes>
187
- [[nodiscard]] SystemScheduler InitialiseAndRegisterComponents (TComponentTypes... deleteInstructionStates)
194
+ [[nodiscard]] SystemScheduler InitialiseAndRegisterComponents (
195
+ std::tuple<TComponentTypes, std::string>... deleteInstructionStatesAndSerialisedTypeNames)
188
196
{
189
197
SystemScheduler scheduler (_threadCount.value_or (0 ));
190
198
@@ -198,7 +206,9 @@ namespace NovelRT::Ecs
198
206
scheduler.RegisterSystem (system );
199
207
}
200
208
201
- scheduler.GetComponentCache ().RegisterComponentType <TComponentTypes...>(deleteInstructionStates...);
209
+ scheduler.GetComponentCache ().RegisterComponentType <TComponentTypes...>(
210
+ std::get<0 >(deleteInstructionStatesAndSerialisedTypeNames)...,
211
+ std::get<1 >(deleteInstructionStatesAndSerialisedTypeNames)...);
202
212
scheduler.SpinThreads ();
203
213
204
214
return scheduler;
0 commit comments