From f163e8f37123e651ea80b690793845b31ddb8639 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 6 Apr 2022 20:52:51 -0700 Subject: Changeset: 2 Work on moving infrastruture to this project --- source/GameObject.hpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 source/GameObject.hpp (limited to 'source/GameObject.hpp') diff --git a/source/GameObject.hpp b/source/GameObject.hpp new file mode 100644 index 0000000..9567edd --- /dev/null +++ b/source/GameObject.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include "GameObjectTypeTag.hpp" +#include "Material.hpp" +#include "Mesh.hpp" +#include "PodVector.hpp" + +#include +#include +#include + +class GameWorld; +class GameObject { +private: + GameWorld* mWorld; + GameObject* mParent; + PodVector mChildren; + glm::quat mRot; + glm::vec3 mPos; + +public: + static void FreeRecursive(GameObject* object); + + // TODO allow moving between worlds + explicit GameObject(GameWorld* world); + virtual ~GameObject(); + + GameWorld* GetWorld() const; + GameObject* GetParent() const; + const PodVector& GetChildren() const; + void AddChild(GameObject* child); + GameObject* RemoveChild(int index); + GameObject* RemoveChild(GameObject* child); + PodVector RemoveAllChildren(); + + // Tag + virtual Tags::GameObjectMemoryManagement GetMemoryManagement() const; + virtual Tags::GameObjectType GetTypeTag() const; + + // Visuals + virtual const Material* GetMeshMaterial() const; + virtual const Mesh* GetMesh() const; + + // Lifetime hooks + virtual void Awaken(); + virtual void Resleep(); + virtual void Update(); + +protected: + void SetParent(GameObject* parent); +}; -- cgit v1.2.3-70-g09d2