#ifndef UIELEMENT_H #define UIELEMENT_H #include "Game/Systems/UI/UITextures/uitexture.h" #include "Game/TypeMap.h" #include class UIElement { public: UIElement(); template void addComponent(std::unique_ptr &&component){ m_components.put(std::forward>(component)); } template bool hasComponent(){ return m_components.contains(); } template T* getComponent(){ auto comp = m_components.find(); assert(comp != m_components.end()); return static_cast(comp->second.get()); } template void removeComponent(){ m_components.remove(); } private: TypeMap> m_components; }; #endif // UIELEMENT_H