#include <Transform.hpp>


Public Member Functions | |
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 |
Protected Member Functions | |
ALLEGRO_TRANSFORM * | get_transformer () |
Protected Attributes | |
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 Protected Attributes | |
static ALLEGRO_TRANSFORM | default_transform = ALLEGRO_TRANSFORM() |
Detailed Description
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
Member Function Documentation
◆ get_angle()
float turbo::Transform::get_angle | ( | ) | const |
Retrieves the rotation of the object
- Returns
- angle in degrees
◆ get_center()
const Vector2< int > & turbo::Transform::get_center | ( | ) | const |
Retrieves the rotation center of the object
- Returns
- position
◆ get_position()
const Vector2< float > & turbo::Transform::get_position | ( | ) | const |
Retrieves the position of the object
- Returns
- position
◆ get_scale()
const Vector2< float > & turbo::Transform::get_scale | ( | ) | const |
Retrieves the scale of the object
- Returns
- scale
◆ rotate()
void turbo::Transform::rotate | ( | float | deg | ) |
Rotate the current object by deg
degrees.
- Warning
- The rotation is added in this function. If you want to set the rotation check set_rotation
- Parameters
-
deg Rotation in degrees
◆ set_center() [1/2]
void turbo::Transform::set_center | ( | const Vector2< int > & | center | ) |
Set the center of rotation of the object (Start in 0,0 , position in pixel)
- Parameters
-
center 2D vector
◆ set_center() [2/2]
void turbo::Transform::set_center | ( | int | x, |
int | y | ||
) |
Set the center of rotation of the object (Start in 0,0 , position in pixel)
- Parameters
-
x X axis (pixels) y Y axis (pixels)
◆ set_position() [1/2]
void turbo::Transform::set_position | ( | const Vector2< float > & | pos | ) |
Set the position of the object.
- Parameters
-
pos 2D vector
◆ set_position() [2/2]
void turbo::Transform::set_position | ( | float | x, |
float | y | ||
) |
Set the position of the object.
- Parameters
-
x X axis y Y axis
◆ set_rotation()
void turbo::Transform::set_rotation | ( | float | deg | ) |
Set the rotation of the object.
- Parameters
-
deg Rotation in degrees [0 - 360]
◆ set_scale() [1/2]
void turbo::Transform::set_scale | ( | const Vector2< float > & | scale | ) |
Set the scale of the object (base scale == 1.0)
- Parameters
-
scale 2D scale
◆ set_scale() [2/2]
void turbo::Transform::set_scale | ( | float | scale_x, |
float | scale_y | ||
) |
Set the scale of the object (base scale == 1.0)
- Parameters
-
scale_x Scale on x axis scale_y Scale on Y axis
◆ translate() [1/2]
void turbo::Transform::translate | ( | const Vector2< float > & | offset | ) |
Translate the object in 22.
- Parameters
-
offset 2D vector
◆ translate() [2/2]
void turbo::Transform::translate | ( | float | x, |
float | y | ||
) |
Translate the object in 2D.
- Parameters
-
x X Axis y Y Axis
Member Data Documentation
◆ angle
|
protected |
angle of the object
- Warning
- The angle should always be in [0 - 360]
The documentation for this class was generated from the following files:
- include/turbo/Transform.hpp
- src/Transform.cpp