SDL Utility
|
A class that stores locational information. More...
#include <Transformable.hpp>
Public Member Functions | |
Transformable () | |
Default constructur. More... | |
virtual | ~Transformable () |
Deconstructor. More... | |
Vector2f | GetPosition () |
Returns the position of the object. More... | |
void | SetPosition (const Vector2f &position) |
Sets a new position. More... | |
void | SetPosition (float x, float y) |
Sets a new position. More... | |
void | Move (const Vector2f &position) |
Adds to the current position. More... | |
void | Move (float x, float y) |
Adds to the current position. More... | |
Vector2f | GetOrigin () |
Gets the current local origin. More... | |
void | SetOrigin (const Vector2f &origin) |
Sets a new local origin. More... | |
void | SetOrigin (float x, float y) |
Sets a new local origin. More... | |
Vector2f | GetScale () |
Gets the current scale of the object. More... | |
void | SetScale (const Vector2f &scale) |
Sets a new scale. More... | |
void | SetScale (float x, float y) |
Sets a new scale. More... | |
void | Scale (const Vector2f &scale) |
Scales the object by some amount. More... | |
void | Scale (float x, float y) |
Scales the object by some amount. More... | |
float | GetRotation () |
Gets the current rotation. More... | |
void | SetRotation (float angle) |
Sets a new rotation. More... | |
void | Rotate (float angle) |
Rotates by some amount. More... | |
Protected Attributes | |
Vector2f | position |
Position of the object. More... | |
Vector2f | origin |
Offset of the top-left corner from the position. More... | |
Vector2f | scale |
Scale of the object. More... | |
float | rotation |
Rotation of the object (in degrees) More... | |
A class that stores locational information.
Stores position, rotation, scale and the origin of an object, and provides functions to get/set those values. "Origin" is the offset between the position and the top-left corner of the object.
Transformable::Transformable | ( | ) |
Default constructur.
|
virtual |
Deconstructor.
Vector2f Transformable::GetOrigin | ( | ) |
Gets the current local origin.
Vector2f Transformable::GetPosition | ( | ) |
Returns the position of the object.
float Transformable::GetRotation | ( | ) |
Gets the current rotation.
Vector2f Transformable::GetScale | ( | ) |
Gets the current scale of the object.
void Transformable::Move | ( | const Vector2f & | position | ) |
Adds to the current position.
[in] | position | A 2D movement vector |
void Transformable::Move | ( | float | x, |
float | y | ||
) |
Adds to the current position.
[in] | x | The offset in x direction |
[in] | y | The offset in y direction |
void Transformable::Rotate | ( | float | angle | ) |
Rotates by some amount.
[in] | angle | The angle to rotate by in degrees |
void Transformable::Scale | ( | const Vector2f & | scale | ) |
Scales the object by some amount.
[in] | scale | The amount to scale by in x- and y-direction |
void Transformable::Scale | ( | float | x, |
float | y | ||
) |
Scales the object by some amount.
[in] | x | The amount to scale by in x direction |
[in] | y | The amount to scale by in y direction |
void Transformable::SetOrigin | ( | const Vector2f & | origin | ) |
Sets a new local origin.
[in] | origin | A 2D vector with the new origin |
void Transformable::SetOrigin | ( | float | x, |
float | y | ||
) |
Sets a new local origin.
[in] | x | The new x component of the origin |
[in] | y | The new y component of the origin |
void Transformable::SetPosition | ( | const Vector2f & | position | ) |
Sets a new position.
[in] | position | A 2D vector with the new position |
void Transformable::SetPosition | ( | float | x, |
float | y | ||
) |
Sets a new position.
[in] | x | The new x position |
[in] | y | The new y position |
void Transformable::SetRotation | ( | float | angle | ) |
Sets a new rotation.
[in] | angle | The new rotation in degrees |
void Transformable::SetScale | ( | const Vector2f & | scale | ) |
Sets a new scale.
[in] | scale | A 2D vector with the new scale |
void Transformable::SetScale | ( | float | x, |
float | y | ||
) |
Sets a new scale.
[in] | x | The new scale in x direction |
[in] | y | The new scale in y direction |
|
protected |
Offset of the top-left corner from the position.
|
protected |
Position of the object.
|
protected |
Rotation of the object (in degrees)
|
protected |
Scale of the object.