@@ -28,22 +28,28 @@ namespace NovelRT::Ecs
2828
2929 inline void AddDefaultComponentsAndSystems (SystemScheduler& target)
3030 {
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" );
3233
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" );
3537
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" );
3842
3943 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" );
4146
4247 target.RegisterSystem (std::make_shared<Ecs::Graphics::DefaultRenderingSystem>(
4348 _graphicsPluginProvider, _windowingPluginProvider, _resourceManagementPluginProvider));
4449
4550 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" );
4753
4854 target.RegisterSystem (
4955 std::make_shared<Ecs::Input::InputSystem>(_windowingPluginProvider, _inputPluginProvider));
@@ -179,12 +185,14 @@ namespace NovelRT::Ecs
179185 * This is the final method you should call to obtain the ECS instance.
180186 *
181187 * @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.
184191 * @returns An instance of the ECS SystemScheduler root object based on the provided configuration.
185192 */
186193 template <typename ... TComponentTypes>
187- [[nodiscard]] SystemScheduler InitialiseAndRegisterComponents (TComponentTypes... deleteInstructionStates)
194+ [[nodiscard]] SystemScheduler InitialiseAndRegisterComponents (
195+ std::tuple<TComponentTypes, std::string>... deleteInstructionStatesAndSerialisedTypeNames)
188196 {
189197 SystemScheduler scheduler (_threadCount.value_or (0 ));
190198
@@ -198,7 +206,9 @@ namespace NovelRT::Ecs
198206 scheduler.RegisterSystem (system);
199207 }
200208
201- scheduler.GetComponentCache ().RegisterComponentType <TComponentTypes...>(deleteInstructionStates...);
209+ scheduler.GetComponentCache ().RegisterComponentType <TComponentTypes...>(
210+ std::get<0 >(deleteInstructionStatesAndSerialisedTypeNames)...,
211+ std::get<1 >(deleteInstructionStatesAndSerialisedTypeNames)...);
202212 scheduler.SpinThreads ();
203213
204214 return scheduler;
0 commit comments