Platformer
Platformer
Component.hpp
1 #ifndef COMPONENT_HPP
2 #define COMPONENT_HPP
3 
4 #include <memory>
5 
6 // Forward declaration
7 class GameObject;
8 
12 class Component {
13  public:
17  std::weak_ptr<GameObject> g);
18 
20  virtual void Init();
21 
23  virtual void Update() = 0;
24 
29  std::shared_ptr<GameObject> GetGameObject();
30 
31  protected:
33  std::weak_ptr<GameObject> gameObject;
34 };
35 
36 #endif
std::shared_ptr< GameObject > GetGameObject()
Gets a shared ptr reference to this component&#39;s GameObject.
Definition: Component.cpp:9
virtual void Update()=0
Updates this component.
void SetParentGameObject(std::weak_ptr< GameObject > g)
Sets the given GameObject as this component&#39;s parent.
Definition: Component.cpp:3
Class representing a component of a GameObject.
Definition: Component.hpp:12
A GameObject class.
Definition: GameObject.hpp:14
virtual void Init()
Initializes this component.
Definition: Component.cpp:7
std::weak_ptr< GameObject > gameObject
This component&#39;s parent GameObject.
Definition: Component.hpp:33