SPARK
0.1.0
A general purpose game engine written in C++.
|
A component that can be attached to a GameObject to provide additional functionality. More...
#include <Component.h>
Public Member Functions | |
Component (GameObject *parent) | |
Instantiates a new Component. | |
Component (const Component &other)=delete | |
Component (Component &&other) noexcept=default | |
Component & | operator= (const Component &other)=delete |
Component & | operator= (Component &&other) noexcept=default |
const lib::Uuid & | uuid () const |
Gets the UUID of the component. | |
GameObject * | gameObject () |
Gets the GameObject that the component is attached to. | |
const GameObject * | gameObject () const |
Gets the GameObject that the component is attached to. | |
virtual void | render () const |
Renders the component. | |
virtual void | onAttach () |
Method called when the component is attached to a GameObject. | |
virtual void | onUpdate (float dt) |
Method called on every frame. | |
virtual void | onDetach () |
Method called when the component is detached from a GameObject. | |
![]() | |
HasRtti (const HasRtti &other)=default | |
HasRtti (HasRtti &&other) noexcept=default | |
HasRtti & | operator= (const HasRtti &other)=default |
HasRtti & | operator= (HasRtti &&other) noexcept=default |
virtual RttiBase & | rttiInstance () const =0 |
A component that can be attached to a GameObject to provide additional functionality.
This class is the base for all components. It should not be used directly but rather inherited from to create a new component.
|
explicit |
Instantiates a new Component.
parent | The GameObject that the component will be attached to. |
|
nodiscard |
Gets the GameObject that the component is attached to.
|
nodiscard |
Gets the GameObject that the component is attached to.
|
inlinevirtual |
Method called on every frame.
dt | The time in seconds since the last frame. |
Reimplemented in spark::core::components::DynamicCollider.
|
inlinevirtual |
Renders the component.
Reimplemented in spark::core::components::Circle, spark::core::components::Image, spark::core::components::Rectangle, and spark::core::components::Text.
|
nodiscard |
Gets the UUID of the component.