diff --git a/core/include/cubos/core/ecs/world.hpp b/core/include/cubos/core/ecs/world.hpp index 6d34d372b..50e550c7b 100644 --- a/core/include/cubos/core/ecs/world.hpp +++ b/core/include/cubos/core/ecs/world.hpp @@ -53,10 +53,16 @@ namespace cubos::core::ecs void registerResource(TArgs... args); /// @brief Registers a component type. - /// @note Should be called before other operations, aside from @ref registerResource(). + /// @param type Component type. + void registerComponent(const reflection::Type& type); + + /// @brief Registers a component type. /// @tparam T Component type. - template - void registerComponent(); + template + void registerComponent() + { + this->registerComponent(reflection::reflect()); + } /// @brief Locks a resource for reading and returns it. /// @tparam T Resource type. @@ -376,13 +382,6 @@ namespace cubos::core::ecs mResourceManager.add(args...); } - template - void World::registerComponent() - { - CUBOS_TRACE("Registered component '{}'", reflection::reflect().name()); - mComponentManager.registerType(reflection::reflect()); - } - template ReadResource World::read() const { diff --git a/core/src/cubos/core/ecs/world.cpp b/core/src/cubos/core/ecs/world.cpp index 29e672070..af895b490 100644 --- a/core/src/cubos/core/ecs/world.cpp +++ b/core/src/cubos/core/ecs/world.cpp @@ -14,6 +14,12 @@ World::World(std::size_t initialCapacity) // Edu: BAH! } +void World::registerComponent(const reflection::Type& type) +{ + CUBOS_TRACE("Registered component '{}'", type.name()); + mComponentManager.registerType(type); +} + Entity World::create() { Entity::Mask mask{};