Browse Source

Lesson 9.12

Godzil 3 years ago
parent
commit
8ca0bedeaa
2 changed files with 9 additions and 2 deletions
  1. 0 1
      source/ECS.cpp
  2. 9 1
      source/include/ECS.h

+ 0 - 1
source/ECS.cpp

@@ -17,7 +17,6 @@ uint32_t Entity::getId() const
     return this->id;
 }
 
-
 /* System */
 void System::addEntity(Entity entity)
 {

+ 9 - 1
source/include/ECS.h

@@ -41,8 +41,16 @@ private:
     uint32_t id;
 
 public:
-    Entity(uint32_t id): id(id) {};
+    explicit Entity(uint32_t id): id(id) {};
+    Entity(const Entity & entity) = default;
+
     uint32_t getId() const;
+
+    Entity& operator=(const Entity & other) = default;
+    bool operator==(const Entity &other) const { return this->id == other.id; };
+    bool operator!=(const Entity &other) const { return this->id != other.id; };
+    bool operator>(const Entity &other) const  { return this->id > other.id; };
+    bool operator<(const Entity &other) const  { return this->id < other.id; };
 };
 
 class System