7 #ifndef NDK_BASECOMPONENT_HPP 8 #define NDK_BASECOMPONENT_HPP 10 #include <NDK/Entity.hpp> 12 #include <unordered_map> 23 using Factory = std::function<BaseComponent*()>;
29 virtual std::unique_ptr<BaseComponent> Clone()
const = 0;
32 ComponentIndex GetIndex()
const;
34 inline static ComponentIndex GetMaxComponentIndex();
42 ComponentIndex m_componentIndex;
45 static ComponentIndex RegisterComponent(ComponentId
id, Factory factoryFunc);
48 virtual void OnAttached();
51 virtual void OnDetached();
52 virtual void OnEntityDestruction();
54 void SetEntity(Entity* entity);
56 static bool Initialize();
57 static void Uninitialize();
65 static std::vector<ComponentEntry> s_entries;
66 static std::unordered_map<ComponentId, ComponentIndex> s_idToIndex;
70 #include <NDK/BaseComponent.inl> 72 #endif // NDK_BASECOMPONENT_HPP TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
NDK class that represents an entity in a world.
Definition: Entity.hpp:28
NDK class that represents the software development kit, a set of tools made to ease the conception of...
Definition: Sdk.hpp:14
NDK class that represents the common base of all components.
Definition: BaseComponent.hpp:17