5#include "ComponentType.hpp"
28 virtual void Update(
float deltaTime) {}
36 static ComponentType
GetType() {
return ComponentType::DEFAULT; }
45 return mGameObject.lock();
58 std::weak_ptr<GameObject> mGameObject;
61#include "GameObject.hpp"
63 return mGameObject.lock()->GetComponent<T>();
Definition Component.hpp:17
virtual void Update(float deltaTime)
Definition Component.hpp:28
void SetGameObject(std::weak_ptr< GameObject > ent)
Sets the GameObject this component is attached to.
Definition Component.hpp:39
virtual void Render()
Definition Component.hpp:32
virtual void Input()
Called once per frame to handle any new input.
Definition Component.hpp:23
static ComponentType GetType()
Returns the type of this component to make querying GetComponent easier.
Definition Component.hpp:36
std::shared_ptr< T > GetComponent()
Alias for GetGameObject()->GetComponent<T>(), for easier scripting.
Definition Component.hpp:62
std::shared_ptr< GameObject > GetGameObject()
Retrieves the GameObject this component is attached to, behind a shared pointer.
Definition Component.hpp:44
Main unit of gameplay which contains and updated components.
Definition GameObject.hpp:13