diff options
Diffstat (limited to 'source/GameObject.hpp')
-rw-r--r-- | source/GameObject.hpp | 51 |
1 files changed, 51 insertions, 0 deletions
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 <glm/glm.hpp> +#include <glm/gtc/quaternion.hpp> +#include <vector> + +class GameWorld; +class GameObject { +private: + GameWorld* mWorld; + GameObject* mParent; + PodVector<GameObject*> 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<GameObject*>& GetChildren() const; + void AddChild(GameObject* child); + GameObject* RemoveChild(int index); + GameObject* RemoveChild(GameObject* child); + PodVector<GameObject*> 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); +}; |