10#include "../Logger/Logger.hpp"
17 return "MovementSystem";
19 return "CollisionSystem";
21 return "HealthSystem";
27 return "BoundarySystem";
29 return "WeaponSystem";
31 return "UnknownSystem";
73 std::vector<Entity> entities;
74 entities.reserve(count);
76 for (
size_t i = 0; i < count; ++i) {
116 auto it =
_systems.find(systemName);
119 it->second->update(*
_registry, deltaTime);
120 }
catch (
const std::exception &e) {
121 LOG_ERROR(
"ECSWorld::update - Error in system '", systemName,
"': ", e.what());
134 it->second->update(*
_registry, deltaTime);
136 }
catch (
const std::exception &e) {
137 LOG_ERROR(
"ECSWorld::updateSystem - Error in system '", name,
"': ", e.what());
157 for (
auto address : allEntities) {
Manages entities, their signatures and component type registrations.
std::vector< Address > view()
Get all entities that have a specific set of components.
Signature getSignature(Address address)
Retrieve the Signature for a given entity address.
Entity createEntity()
Create a new entity.
std::unordered_map< std::string, std::unique_ptr< ISystem > > _systems
Entity getEntity(Address address)
Get an entity wrapper from an address.
void update(float deltaTime)
Update all registered systems.
~ECSWorld()
Destroy the ECSWorld and cleanup resources.
std::unique_ptr< Registry > _registry
std::vector< Entity > createEntities(size_t count)
Create multiple entities at once.
Registry & getRegistry()
Get direct access to the underlying registry.
void destroyEntity(const Entity &entity)
Destroy an entity and remove it from the world.
void clear()
Clear all entities from the world.
ECSWorld()
Construct a new ECSWorld.
std::vector< std::string > _systemsOrder
bool updateSystem(const std::string &name, float deltaTime)
Update a specific system by name.
void removeSystem(const std::string &name)
Remove a system from the world.
size_t getSystemCount() const
Get the number of systems registered.
High-level entity wrapper providing fluent interface.
Entity(Address address, Registry *registry)
Construct an Entity wrapper.
Address getAddress() const
Get the entity's address.
bool isValid() const
Check if this entity is valid.
std::string_view systemIdToName(SystemId id)
std::uint32_t Address
Type used to represent an entity address/ID.