aboutsummaryrefslogtreecommitdiff
path: root/mwe/ecs-homemade/inc
diff options
context:
space:
mode:
Diffstat (limited to 'mwe/ecs-homemade/inc')
-rw-r--r--mwe/ecs-homemade/inc/ComponentManager.h12
-rw-r--r--mwe/ecs-homemade/inc/ComponentManager.hpp12
2 files changed, 19 insertions, 5 deletions
diff --git a/mwe/ecs-homemade/inc/ComponentManager.h b/mwe/ecs-homemade/inc/ComponentManager.h
index 763c28e..893aa56 100644
--- a/mwe/ecs-homemade/inc/ComponentManager.h
+++ b/mwe/ecs-homemade/inc/ComponentManager.h
@@ -18,12 +18,16 @@ public:
ComponentManager& operator=(ComponentManager&&) = delete; //Singleton
template <typename T, typename... Args>
- void AddComponent(std::uint32_t id, Args&&... args); //Add a component
- //TODO: void DeleteAllComponentsOfId(std::uint32_t id); //Deletes all components of a specific id
- //TODO: void DeleteAllComponents(); //Deletes all components
+ void AddComponent(std::uint32_t id, Args&&... args); //Add a component of a specific type
+ template <typename T>
+ void DeleteComponentsById(std::uint32_t id); //Deletes all components of a specific type and id
+ template <typename T>
+ void DeleteComponents(); //Deletes all components of a specific type
+ void DeleteAllComponentsOfId(std::uint32_t id); //Deletes all components of a specific id
+ void DeleteAllComponents(); //Deletes all components
template <typename T>
- std::vector<std::reference_wrapper<T>> GetComponentsByID(std::uint32_t id) const; //Get a vector<> of all components at specific id
+ std::vector<std::reference_wrapper<T>> GetComponentsByID(std::uint32_t id) const; //Get a vector<> of all components at specific type and id
template <typename T>
std::vector<std::pair<std::reference_wrapper<T>, std::uint32_t>> GetComponentsByType() const; //Get a vector<> of all components of a specific type
diff --git a/mwe/ecs-homemade/inc/ComponentManager.hpp b/mwe/ecs-homemade/inc/ComponentManager.hpp
index 03135a8..18bd548 100644
--- a/mwe/ecs-homemade/inc/ComponentManager.hpp
+++ b/mwe/ecs-homemade/inc/ComponentManager.hpp
@@ -15,6 +15,16 @@ void ComponentManager::AddComponent(std::uint32_t id, Args&&... args) {
}
template <typename T>
+void ComponentManager::DeleteComponentsById(std::uint32_t id) {
+
+}
+
+template <typename T>
+void ComponentManager::DeleteComponents() {
+
+}
+
+template <typename T>
std::vector<std::reference_wrapper<T>> ComponentManager::GetComponentsByID(std::uint32_t id) const {
std::type_index type = typeid(T); //Determine the type of T (this is used as the key of the unordered_map<>)
@@ -62,5 +72,5 @@ std::vector<std::pair<std::reference_wrapper<T>, std::uint32_t>> ComponentManage
}
}
- return componentVector;
+ return componentVector; //Return the vector<>
}