Turbo Engine 0.3
A C++ game engine using Allegro 5
turbo::Component Class Reference

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.
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.
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.
const char * get_name () const
 Display name of the component (used by the editor).

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

◆ disable()

void turbo::Component::disable ( )

Disable the component. Do nothing if already disabled.

◆ enable()

void turbo::Component::enable ( )

Enable the component. Do nothing if already enabled.

◆ get_name()

const char * turbo::Component::get_name ( ) const

Display name of the component (used by the editor).

◆ is_enabled()

bool turbo::Component::is_enabled ( )

Check if the component is enabled.

Returns
true if enabled

◆ load()

virtual void turbo::Component::load ( )
inlinevirtual

Called when the component is loaded into the scene.

Reimplemented in turbo::component::SimpleControl, and turbo::LuaComponent.

◆ on_disable()

virtual void turbo::Component::on_disable ( )
inlinevirtual

Called when the component is disabled.

Reimplemented in turbo::component::SimpleControl, and turbo::LuaComponent.

◆ on_enable()

virtual void turbo::Component::on_enable ( )
inlinevirtual

Called when the component is enabled (Not called on the first initialization).

Reimplemented in turbo::component::SimpleControl, and turbo::LuaComponent.

◆ unload()

virtual void turbo::Component::unload ( )
inlinevirtual

Called when the component is unloaded.

Reimplemented in turbo::component::SimpleControl, and turbo::LuaComponent.

◆ 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, and turbo::LuaComponent.

Member Data Documentation

◆ debug_inspector_observers

::std::vector<debug::InspectorObserver*> turbo::Component::debug_inspector_observers {}

Debug use only. List of observed values in the inspector.

◆ enabled

bool turbo::Component::enabled = true
protected

◆ gameObject

GameObject* turbo::Component::gameObject = nullptr
protected

◆ name

const char* turbo::Component::name = "Unknown"
protected

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