blob: 01a47f5c9f19315c153c2adc352860e347ee8ce3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <bitset>
#include <vector>
/**
* 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
{
public:
Entity createEntity();
EntityManager &deleteEntity(Entity entity);
void addComponent(Entity entity, BaseComponent *component);
private:
Entity next_entity_;
std::vector<BaseComponentGroup *> component_group_;
std::vector<ComponentMask> component_masks_;
};
|