aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/GameObject.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 16:26:38 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 16:26:38 +0100
commitb63f4700f7bda696afb14cc3111be0f8b0eed458 (patch)
tree08c4b00b249a4fa672d97a5bc79927adac0a0257 /src/crepe/api/GameObject.h
parent2933655dea64f11f200f42fe51e58dacc5f160eb (diff)
parent9e87a556a5f68c5f9bb04bef9a66880536ccd6e8 (diff)
merge `loek/tests` into `loek/cleanup` (close #32)
Diffstat (limited to 'src/crepe/api/GameObject.h')
-rw-r--r--src/crepe/api/GameObject.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/crepe/api/GameObject.h b/src/crepe/api/GameObject.h
index d703730..73ff0b8 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
@@ -16,11 +17,12 @@ class Vector2;
* 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
@@ -28,9 +30,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
*
@@ -58,6 +64,9 @@ public:
public:
//! The id of the GameObject
const game_object_id_t id;
+
+protected:
+ ComponentManager & component_manager;
};
} // namespace crepe