4#include <unordered_map>
6#include "../Entity/entity.h"
27 virtual void addEntity(std::shared_ptr<GameWorld> world,
const Entity& entity) = 0;
44template <
typename... Component>
58 virtual void addEntity(std::shared_ptr<GameWorld> world,
const Entity& entity)
override;
67 typename std::vector<std::tuple<Entity, ComponentReference<Component>...>>::iterator
begin();
68 typename std::vector<std::tuple<Entity, ComponentReference<Component>...>>::iterator
end();
69 typename std::vector<std::tuple<Entity, ComponentReference<Component>...>>::const_iterator
begin()
const;
70 typename std::vector<std::tuple<Entity, ComponentReference<Component>...>>::const_iterator
end()
const;
72 std::vector<std::tuple<Entity, ComponentReference<Component>...>> allData;
73 std::unordered_map<Entity, size_t> entityToIndex;
82 std::tuple<Entity, ComponentReference<Component>...> createTuple(std::shared_ptr<GameWorld> world,
const Entity& entity);
Effectively a list of tuples each entry containing an Entity and ComponentReference to each of the co...
Definition: componentGroup.h:45
virtual ~ComponentGroup()
Destroy the Component Group object.
Definition: componentGroup.h:50
std::vector< std::tuple< Entity, ComponentReference< Component >... > >::iterator end()
Definition: componentGroup.inl:47
virtual void removeEntity(Entity entity) override
Remove an entity from the ComponentGroup.
Definition: componentGroup.inl:22
std::vector< std::tuple< Entity, ComponentReference< Component >... > >::iterator begin()
Definition: componentGroup.inl:44
virtual void addEntity(std::shared_ptr< GameWorld > world, const Entity &entity) override
Add an Entity to the Group. This entity must contain all the required components. If such an entity a...
Definition: componentGroup.inl:11
Generic group of components.
Definition: componentGroup.h:15
virtual ~IComponentGroup()=default
Destroy the IComponentGroup object.
virtual void removeEntity(Entity entity)=0
Handle removing an entity from a group.
virtual void addEntity(std::shared_ptr< GameWorld > world, const Entity &entity)=0
Handle adding an entity to a group. This entity must have all the components specified by the group.