diff options
Diffstat (limited to 'src/crepe/Component.h')
-rw-r--r-- | src/crepe/Component.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/crepe/Component.h b/src/crepe/Component.h index 0fe60b2..c6d72df 100644 --- a/src/crepe/Component.h +++ b/src/crepe/Component.h @@ -2,8 +2,6 @@ #include "types.h" -#include <cstdint> - namespace crepe { class ComponentManager; @@ -15,13 +13,21 @@ class ComponentManager; * interface for all components. */ class Component { +public: + struct Data { + //! The ID of the GameObject this component belongs to + const game_object_id_t id; + //! The manager of this component + ComponentManager & component_manager; + }; + protected: - //! Only the ComponentManager can create components - friend class crepe::ComponentManager; /** - * \param id The id of the GameObject this component belongs to + * \param base Data */ - Component(game_object_id_t id); + Component(const Data & base); + //! Only the ComponentManager can create components + friend class crepe::ComponentManager; public: virtual ~Component() = default; @@ -37,8 +43,7 @@ public: virtual int get_instances_max() const { return -1; } public: - //! The id of the GameObject this component belongs to - const game_object_id_t game_object_id; + Data data; //! Whether the component is active bool active = true; }; |