13 for (
auto& system : _systems) {
25 std::size_t entity_id = _next_entity_id++;
26 _entities.push_back(entity_id);
37 auto end = std::remove(_entities.begin(), _entities.end(), entity);
39 for (
auto& [type, container] : _components) {
40 _erase_functions[type](entity);
std::vector< GameMessage > syncGameState(Registry &r)
Creates the.
Represents an entity in an Entity-Component-System (ECS) architecture.
A utility class for dispatching and handling game events.
A thread-safe queue for storing and managing GameMessage objects.
Entity entity_from_index(std::size_t idx) const
Retrieves an entity by its index.
void run_systems()
Executes all registered systems.
void kill_entity(const Entity &entity)
Deletes an entity and removes all its components.
Entity spawn_entity()
Creates a new entity.
EventDispatcher * dispatcher
std::vector< GameMessage > sync_game()
Creates a list of GameMessages that syncs the player to the game.
Registry(EventDispatcher *_dispatcher, Queue *_queue)
Default constructor.
void setup_systems(Registry &r)
Sets up all the necessary systems for the game.
void setup_components(Registry &r)
Registers components in the given registry.