aboutsummaryrefslogtreecommitdiff
path: root/mwe/ecs-homemade/inc/ComponentManager.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 14:56:05 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 14:56:05 +0200
commit0fdebc7d7a143ad2b9b5ed6a596bf4bb1f0f7d7f (patch)
tree7400cea54bc40b01f64cf91c26a4ae20980a64cc /mwe/ecs-homemade/inc/ComponentManager.h
parenta2c719948ff8af9abe267c4d1c9b16cd1e2fb317 (diff)
parent77555730e3ddb811b9ce8470659663e3f1573de2 (diff)
merge master into loek/scripts
Diffstat (limited to 'mwe/ecs-homemade/inc/ComponentManager.h')
-rw-r--r--mwe/ecs-homemade/inc/ComponentManager.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/mwe/ecs-homemade/inc/ComponentManager.h b/mwe/ecs-homemade/inc/ComponentManager.h
index d368516..0ba358e 100644
--- a/mwe/ecs-homemade/inc/ComponentManager.h
+++ b/mwe/ecs-homemade/inc/ComponentManager.h
@@ -17,24 +17,27 @@ public:
ComponentManager & operator=(const ComponentManager &) = delete; //Singleton
ComponentManager & operator=(ComponentManager &&) = delete; //Singleton
+ //Add a component of a specific type
template <typename T, typename... Args>
- void AddComponent(std::uint32_t id,
- Args &&... args); //Add a component of a specific type
+ T & AddComponent(std::uint32_t id, Args &&... args);
+ //Deletes all components of a specific type and id
template <typename T>
- void DeleteComponentsById(
- std::uint32_t id); //Deletes all components of a specific type and id
+ void DeleteComponentsById(std::uint32_t id);
+ //Deletes all components of a specific type
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
+ void DeleteComponents();
+ //Deletes all components of a specific id
+ void DeleteAllComponentsOfId(std::uint32_t id);
+ //Deletes all components
+ void DeleteAllComponents();
+ //Get a vector<> of all components at specific type and id
template <typename T>
- std::vector<std::reference_wrapper<T>> GetComponentsByID(std::uint32_t id)
- const; //Get a vector<> of all components at specific type and id
+ std::vector<std::reference_wrapper<T>>
+ GetComponentsByID(std::uint32_t id) const;
+ //Get a vector<> of all components of a specific type
template <typename T>
- std::vector<std::reference_wrapper<T>> GetComponentsByType()
- const; //Get a vector<> of all components of a specific type
+ std::vector<std::reference_wrapper<T>> GetComponentsByType() const;
private:
static ComponentManager mInstance; //Singleton