Components who defines the behaviour of a GameObject. More...

#include <Component.hpp>

+ Inheritance diagram for turbo::Component:
+ Collaboration diagram for turbo::Component:

Public Member Functions

 Component (GameObject *parent)
 Construct a new Component. The component will be automatically added to the GameObject given as parameter. More...
 
virtual void load ()
 Called when the component is loaded into the scene.
 
virtual void on_disable ()
 Called when the component is disabled.
 
virtual void on_enable ()
 Called when the component is enabled (Not called on the first initialization)
 
virtual void update (int delta_time)
 Logic update. Souldn't be used for anything else than logic. More...
 
virtual void unload ()
 Called when the component is unloaded.
 
void disable ()
 Disable the component. Do nothing if already disabled.
 
void enable ()
 Enable the component. Do nothing if already enabled.
 
bool is_enabled ()
 Check if the component is enabled. More...
 
const char * get_name () const
 

Public Attributes

::std::vector< debug::InspectorObserver * > debug_inspector_observers {}
 Debug use only. List of observed values in the inspector.
 

Protected Attributes

GameObjectgameObject = nullptr
 
bool enabled = true
 
const char * name = "Unknown"
 

Detailed Description

Components who defines the behaviour of a GameObject.

Constructor & Destructor Documentation

◆ Component()

turbo::Component::Component ( GameObject parent)
explicit

Construct a new Component. The component will be automatically added to the GameObject given as parameter.

Parameters
parentGameObject that holds the component

Member Function Documentation

◆ is_enabled()

bool turbo::Component::is_enabled ( )

Check if the component is enabled.

Returns
true if enabled

◆ update()

virtual void turbo::Component::update ( int  delta_time)
inlinevirtual

Logic update. Souldn't be used for anything else than logic.

Parameters
delta_timemilliseconds since the last call

Reimplemented in turbo::component::SimpleControl.


The documentation for this class was generated from the following files: