|
Turbo Engine 0.3
A C++ game engine using Allegro 5
|
#include <Transform.hpp>
Public Member Functions | |
| Transform ()=default | |
| 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) | |
| ~Transform ()=default | |
| void | translate (float x, float y) |
| Translate the object in 2D. | |
| void | translate (const Vector2< float > &offset) |
| Translate the object in 22. | |
| void | set_position (float x, float y) |
| Set the position of the object. | |
| void | set_position (const Vector2< float > &pos) |
| Set the position of the object. | |
| void | rotate (float deg) |
| Rotate the current object by deg degrees. | |
| void | set_rotation (float deg) |
| Set the rotation of the object. | |
| void | set_center (int x, int y) |
| Set the center of rotation of the object (Start in 0,0 , position in pixel). | |
| void | set_center (const Vector2< int > ¢er) |
| Set the center of rotation of the object (Start in 0,0 , position in pixel). | |
| void | set_scale (const Vector2< float > &scale) |
| Set the scale of the object (base scale == 1.0). | |
| void | set_scale (float scale_x, float scale_y) |
| Set the scale of the object (base scale == 1.0). | |
| const Vector2< float > & | get_position () const |
| const Vector2< float > & | get_scale () const |
| const Vector2< int > & | get_center () const |
| float | get_angle () const |
Protected Member Functions | |
| ALLEGRO_TRANSFORM * | get_transformer () |
Protected Attributes | |
| float | angle = 0 |
| angle of the object | |
| Vector2< float > | position = Vector2<float>() |
| Vector2< float > | scale = Vector2<float>(1, 1) |
| Vector2< int > | center = Vector2<int>() |
| ALLEGRO_TRANSFORM | transform {} |
| bool | property_has_changed = true |
Static Protected Attributes | |
| static ALLEGRO_TRANSFORM | default_transform = ALLEGRO_TRANSFORM() |
Transform is a parent class used to make an object "movable"
The objective is to create a 4x4 transformation matrix used to calculate the rendering
|
default |
| turbo::Transform::Transform | ( | const Vector2< float > & | position, |
| float | angle = 0, | ||
| const Vector2< float > & | scale = Vector2<float>(1, 1), | ||
| const Vector2< int > & | center = Vector2<int>() ) |
| turbo::Transform::Transform | ( | float | x, |
| float | y = 0, | ||
| int | scaleX = 1, | ||
| int | scaleY = 1, | ||
| float | angle = 0, | ||
| int | centerX = 0, | ||
| int | centerY = 0 ) |
|
default |
| float turbo::Transform::get_angle | ( | ) | const |
Retrieves the rotation of the object
| const Vector2< int > & turbo::Transform::get_center | ( | ) | const |
Retrieves the rotation center of the object
| const Vector2< float > & turbo::Transform::get_position | ( | ) | const |
Retrieves the position of the object
| const Vector2< float > & turbo::Transform::get_scale | ( | ) | const |
Retrieves the scale of the object
|
protected |
| void turbo::Transform::rotate | ( | float | deg | ) |
Rotate the current object by deg degrees.
| deg | Rotation in degrees |
| void turbo::Transform::set_center | ( | const Vector2< int > & | center | ) |
Set the center of rotation of the object (Start in 0,0 , position in pixel).
| center | 2D vector |
| void turbo::Transform::set_center | ( | int | x, |
| int | y ) |
Set the center of rotation of the object (Start in 0,0 , position in pixel).
| x | X axis (pixels) |
| y | Y axis (pixels) |
| void turbo::Transform::set_position | ( | const Vector2< float > & | pos | ) |
Set the position of the object.
| pos | 2D vector |
| void turbo::Transform::set_position | ( | float | x, |
| float | y ) |
Set the position of the object.
| x | X axis |
| y | Y axis |
| void turbo::Transform::set_rotation | ( | float | deg | ) |
Set the rotation of the object.
| deg | Rotation in degrees [0 - 360] |
| void turbo::Transform::set_scale | ( | const Vector2< float > & | scale | ) |
Set the scale of the object (base scale == 1.0).
| scale | 2D scale |
| void turbo::Transform::set_scale | ( | float | scale_x, |
| float | scale_y ) |
Set the scale of the object (base scale == 1.0).
| scale_x | Scale on x axis |
| scale_y | Scale on Y axis |
| void turbo::Transform::translate | ( | const Vector2< float > & | offset | ) |
Translate the object in 22.
| offset | 2D vector |
| void turbo::Transform::translate | ( | float | x, |
| float | y ) |
Translate the object in 2D.
| x | X Axis |
| y | Y Axis |
|
protected |
angle of the object
|
inlinestaticprotected |
|
protected |
|
protected |