turbo::GameObject Class Referencefinal
Basic scene object. More...
#include <GameObject.hpp>


Public Member Functions | |
GameObject (GameObject *parent, std::string name) | |
Construct a new GameObject object. More... | |
void | add_component (Component *comp) |
Add a component to the GameObject. More... | |
void | remove_component (Component *comp) |
Remove a component to the GameObject. More... | |
unsigned short | get_component_amount () const |
void | render (void *transform) |
void | update (int delta_time) |
void | set_drawable (Drawable *drawable) |
Drawable * | get_drawable () const |
std::string | get_name () const |
template<typename T , typename = std::enable_if_t<std::is_base_of_v<Component, T>>> | |
T * | get_component () |
Get the component object. More... | |
![]() | |
Transform (const Vector2< float > &position, float angle=0, const Vector2< float > &scale=Vector2< float >(1, 1), const Vector2< int > ¢er=Vector2< int >()) | |
Transform (float x, float y=0, int scaleX=1, int scaleY=1, float angle=0, int centerX=0, int centerY=0) | |
void | translate (float x, float y) |
Translate the object in 2D. More... | |
void | translate (const Vector2< float > &offset) |
Translate the object in 22. More... | |
void | set_position (float x, float y) |
Set the position of the object. More... | |
void | set_position (const Vector2< float > &pos) |
Set the position of the object. More... | |
void | rotate (float deg) |
Rotate the current object by deg degrees. More... | |
void | set_rotation (float deg) |
Set the rotation of the object. More... | |
void | set_center (int x, int y) |
Set the center of rotation of the object (Start in 0,0 , position in pixel) More... | |
void | set_center (const Vector2< int > ¢er) |
Set the center of rotation of the object (Start in 0,0 , position in pixel) More... | |
void | set_scale (const Vector2< float > &scale) |
Set the scale of the object (base scale == 1.0) More... | |
void | set_scale (float scale_x, float scale_y) |
Set the scale of the object (base scale == 1.0) More... | |
const Vector2< float > & | get_position () const |
const Vector2< float > & | get_scale () const |
const Vector2< int > & | get_center () const |
float | get_angle () const |
Public Attributes | |
bool | show = true |
std::vector< GameObject * > | childs {} |
std::vector< Component * > | components {} |
Additional Inherited Members | |
![]() | |
ALLEGRO_TRANSFORM * | get_transformer () |
![]() | |
float | angle = 0 |
angle of the object More... | |
Vector2< float > | position = Vector2<float>() |
Vector2< float > | scale = Vector2<float>(1, 1) |
Vector2< int > | center = Vector2<int>() |
ALLEGRO_TRANSFORM * | transform = new ALLEGRO_TRANSFORM() |
bool | property_has_changed = true |
![]() | |
static ALLEGRO_TRANSFORM | default_transform = ALLEGRO_TRANSFORM() |
Detailed Description
Basic scene object.
Constructor & Destructor Documentation
◆ GameObject()
|
explicit |
Construct a new GameObject object.
- Parameters
-
parent parent GameObject or null if root node name GameObject name
Member Function Documentation
◆ add_component()
void turbo::GameObject::add_component | ( | Component * | comp | ) |
Add a component to the GameObject.
- Parameters
-
comp component instance
◆ get_component()
template<typename T , typename = std::enable_if_t<std::is_base_of_v<Component, T>>>
|
inline |
Get the component object.
- Template Parameters
-
T Type of component
- Returns
- T* instance of the component
◆ remove_component()
void turbo::GameObject::remove_component | ( | Component * | comp | ) |
Remove a component to the GameObject.
- Parameters
-
comp component instance
The documentation for this class was generated from the following files:
- include/turbo/GameObject.hpp
- src/GameObject.cpp