turbo::component::SimpleControl Class Reference

Simple pre-made component used handle an 8-direction movement with the arrow keys. More...

#include <SimpleControl.hpp>

+ Inheritance diagram for turbo::component::SimpleControl:
+ Collaboration diagram for turbo::component::SimpleControl:

Public Member Functions

void load () override
 Called when the component is loaded into the scene.
 
void on_disable () override
 Called when the component is disabled.
 
void on_enable () override
 Called when the component is enabled (Not called on the first initialization)
 
void unload () override
 Called when the component is unloaded.
 
void update (int delta_time) override
 Logic update. Souldn't be used for anything else than logic. More...
 
- Public Member Functions inherited from turbo::Component
 Component (GameObject *parent)
 Construct a new Component. The component will be automatically added to the GameObject given as parameter. More...
 
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

float acceleration = 1.0
 
float max_speed = 15
 
float friction = 0.1
 
- Public Attributes inherited from turbo::Component
::std::vector< debug::InspectorObserver * > debug_inspector_observers {}
 Debug use only. List of observed values in the inspector.
 

Protected Attributes

::turbo::Vector2< float > velocity = ::turbo::Vector2<float>()
 
- Protected Attributes inherited from turbo::Component
GameObjectgameObject = nullptr
 
bool enabled = true
 
const char * name = "Unknown"
 

Detailed Description

Simple pre-made component used handle an 8-direction movement with the arrow keys.

Member Function Documentation

◆ update()

void turbo::component::SimpleControl::update ( int  delta_time)
overridevirtual

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

Parameters
delta_timemilliseconds since the last call

Reimplemented from turbo::Component.


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