aboutsummaryrefslogtreecommitdiffstats
path: root/yage/entity/entity.h
diff options
context:
space:
mode:
Diffstat (limited to 'yage/entity/entity.h')
-rw-r--r--yage/entity/entity.h44
1 files changed, 13 insertions, 31 deletions
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 <bitset>
+#pragma once
+
#include <vector>
-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 <typename T>
-class System;
-
-class BaseComponent;
-
-template <typename T>
-class Component;
-
-class BaseComponentGroup;
-
-template <typename T>
-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<BaseComponentGroup *> component_group_;
+public:
+ std::vector<ComponentGroup> component_group_;
std::vector<ComponentMask> component_masks_;
std::vector<Entity> deleted_;
};