From 774a0acb51b7e97c1f7951fc90ddd51c19527a50 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 22 Jun 2018 00:07:37 +0100 Subject: Expanding entity system --- yage/entity/entity.h | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) (limited to 'yage/entity/entity.h') diff --git a/yage/entity/entity.h b/yage/entity/entity.h index d9a221b9..2aa31a66 100644 --- a/yage/entity/entity.h +++ b/yage/entity/entity.h @@ -1,40 +1,21 @@ -#include +#pragma once + #include -namespace yage { +#include "component.h" + +namespace yage +{ -/** +/** * The entity is currently just an unsigned integer, which may change to a * class in the future. */ typedef unsigned int Entity; -/** - * The component mask represents all the components that the entity is - * currently attached to. - */ -typedef std::bitset<64> ComponentMask; - -class EntityManager; - -class BaseSystem; - -template -class System; - -class BaseComponent; - -template -class Component; - -class BaseComponentGroup; - -template -class ComponentGroup; - -/** +/** * Has to keep track of all the different entities and their current state. - * + * * The key actions on an Entity are: deleting, creating. */ class EntityManager @@ -43,14 +24,15 @@ public: Entity create_entity(); EntityManager &delete_entity(Entity entity); bool is_valid(Entity entity) const; - void add_component(Entity entity, BaseComponent *component); + EntityManager &add_component(Entity entity, BaseComponent *component); private: Entity update_next_entity(); - Entity next_entity_; + Entity next_entity_ = 0; - std::vector component_group_; +public: + std::vector component_group_; std::vector component_masks_; std::vector deleted_; }; -- cgit