diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-18 15:34:22 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-18 15:34:22 +0100 |
commit | b92da3c729c8fc7c002cb3acbb75c56cb63bd89e (patch) | |
tree | 454b64d31b7e0c9151da88a0d49ee782565f49e9 /src/crepe/api/GameObject.h | |
parent | 8b449e764b5c91cd3cb0c4fa404a290ab295a7ef (diff) | |
parent | 121b64b1cb6cfead5814070c8b0185d3d7308095 (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/events
Diffstat (limited to 'src/crepe/api/GameObject.h')
-rw-r--r-- | src/crepe/api/GameObject.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/crepe/api/GameObject.h b/src/crepe/api/GameObject.h index 75c164b..34ef8bb 100644 --- a/src/crepe/api/GameObject.h +++ b/src/crepe/api/GameObject.h @@ -2,11 +2,12 @@ #include <string> +#include "Vector2.h" #include "types.h" namespace crepe { -class Vector2; +class ComponentManager; /** * \brief Represents a GameObject @@ -15,11 +16,12 @@ class Vector2; * the game programmer. The actual implementation is done in the ComponentManager. */ class GameObject { -public: +private: /** * This constructor creates a new GameObject. It creates a new Transform and Metadata * component and adds them to the ComponentManager. * + * \param component_manager Reference to component_manager * \param id The id of the GameObject * \param name The name of the GameObject * \param tag The tag of the GameObject @@ -27,8 +29,13 @@ public: * \param rotation The rotation of the GameObject * \param scale The scale of the GameObject */ - GameObject(game_object_id_t id, const std::string & name, const std::string & tag, - const Vector2 & position, double rotation, double scale); + GameObject(ComponentManager & component_manager, game_object_id_t id, + const std::string & name, const std::string & tag, const Vector2 & position, + double rotation, double scale); + //! ComponentManager instances GameObject + friend class ComponentManager; + +public: /** * \brief Set the parent of this GameObject * @@ -56,6 +63,9 @@ public: public: //! The id of the GameObject const game_object_id_t id; + +protected: + ComponentManager & component_manager; }; } // namespace crepe |