cangine
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1// component.hpp
2#pragma once
3
4#include "../../platform/mouse.hpp"
5
6namespace cangine {
7 class GameObject;
8
17 class IComponent {
18 private:
20 friend class GameObject;
21
22 public:
23 bool isUnique = true;
24
30 virtual ~IComponent();
31
37
39 virtual void firstFrame() { };
44 virtual void frame(double deltaTime) { };
49 virtual void onMouseEvent(const MouseEvent* e) { };
50 };
51}
Base class for everything that lives in the scene.
Definition game_object.hpp:20
Base interface for all components attached to a GameObject.
Definition component.hpp:17
bool isUnique
If true, only one of this component type may exist per object.
Definition component.hpp:23
virtual void firstFrame()
Called once before the first frame update.
Definition component.hpp:39
GameObject * getGameObject() const
Returns the game object this component is attached to.
Definition component.cpp:11
virtual void onMouseEvent(const MouseEvent *e)
Called when a mouse event is dispatched to the owning object.
Definition component.hpp:49
GameObject * gameObject
Owning game object.
Definition component.hpp:19
virtual void frame(double deltaTime)
Called every frame to update the component.
Definition component.hpp:44
Definition audiomanager.cpp:4
A mouse event carrying its type, button, position and scroll offset.
Definition mouse.hpp:37