diff options
Diffstat (limited to 'mwe/ecs-homemade/inc/ComponentManager.h')
-rw-r--r-- | mwe/ecs-homemade/inc/ComponentManager.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mwe/ecs-homemade/inc/ComponentManager.h b/mwe/ecs-homemade/inc/ComponentManager.h index cfc5f20..5b0629f 100644 --- a/mwe/ecs-homemade/inc/ComponentManager.h +++ b/mwe/ecs-homemade/inc/ComponentManager.h @@ -17,21 +17,21 @@ public: ComponentManager& operator=(const ComponentManager&) = delete; ComponentManager& operator=(ComponentManager&&) = delete; + template <typename T, typename... Args> + void AddComponent(std::uint32_t id, Args&&... args); template <typename T> - void AddComponent(T* component, std::uint32_t id); - template <typename T> - T* GetComponent(std::uint32_t id); - template <typename T> + std::vector<std::reference_wrapper<T>> GetComponentsOfID(std::uint32_t id); + /*template <typename T> std::vector<std::uint32_t> GetAllComponentIDs(); template <typename T> - std::vector<T*> GetAllComponentPointer(); + std::vector<T*> GetAllComponentPointer();*/ private: static ComponentManager mInstance; ComponentManager(); - std::unordered_map<std::type_index, std::vector<Component*>> mComponents; //TODO: Make this not only work with Component* OR add extra checks at templated methodes!!! + std::unordered_map<std::type_index, std::vector<std::vector<std::unique_ptr<Component>>>> mComponents; }; #include "ComponentManager.hpp" |