31 std::unique_ptr<BaseComponent> &&component);
36 Entity update_next_entity();
40 std::vector<ComponentGroup> component_group_;
41 std::vector<ComponentMask> component_masks_;
42 std::vector<Entity> deleted_;
50 for (
auto it = component_group_[
id].begin();
51 it != component_group_[id].end(); ++it) {
52 auto iteration = it - component_group_[id].begin();
53 if (
is_valid(iteration) && component_masks_[iteration][
id]) {
54 update(*static_cast<T *>((*it).get()));
Definition: component.h:18
Has to keep track of all the different entities and their current state.
Definition: entity.h:24
Entity create_entity()
Definition: entity.cpp:12
unsigned int Entity
The entity is currently just an unsigned integer, which may change to a class in the future...
Definition: entity.h:17
EntityManager & each(std::function< void(T &)> update)
Definition: entity.h:46
EntityManager & delete_entity(Entity entity)
Definition: entity.cpp:19
EntityManager & add_component(Entity entity, std::unique_ptr< BaseComponent > &&component)
Definition: entity.cpp:35
bool is_valid(Entity entity) const
Definition: entity.cpp:25