|
@@ -10,6 +10,15 @@
|
|
|
#ifndef GAMEENGINE_ECS_H
|
|
|
#define GAMEENGINE_ECS_H
|
|
|
|
|
|
+#include <stdint.h>
|
|
|
+
|
|
|
+#include <bitset>
|
|
|
+#include <vector>
|
|
|
+
|
|
|
+const uint32_t MAX_COMPONENTS = 32;
|
|
|
+
|
|
|
+typedef std::bitset<MAX_COMPONENTS> Signature;
|
|
|
+
|
|
|
class Component
|
|
|
{
|
|
|
|
|
@@ -17,12 +26,28 @@ class Component
|
|
|
|
|
|
class Entity
|
|
|
{
|
|
|
+private:
|
|
|
+ uint32_t id;
|
|
|
|
|
|
+public:
|
|
|
+ Entity(uint32_t id): id(id) {};
|
|
|
+ uint32_t getId() const;
|
|
|
};
|
|
|
|
|
|
class System
|
|
|
{
|
|
|
-
|
|
|
+private:
|
|
|
+ Signature componentSignature;
|
|
|
+ std::vector<Entity> entities;
|
|
|
+
|
|
|
+public:
|
|
|
+ System() = default;
|
|
|
+ ~System() = default;
|
|
|
+
|
|
|
+ void addEntity(Entity entity);
|
|
|
+ void removeEntity(Entity entity);
|
|
|
+ std::vector<Entity> getEntities() const;
|
|
|
+ Signature& getComponentSignature() const;
|
|
|
};
|
|
|
|
|
|
class Registry
|