SDL Utility
Transformable.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "structures/Vector2.hpp"
10 
21 {
22 public:
27 
31  virtual ~Transformable();
32 
39 
46 
53  void SetPosition(float x, float y);
54 
60  void Move(const Vector2f& position);
61 
68  void Move(float x, float y);
69 
70 
77 
83  void SetOrigin(const Vector2f& origin);
84 
91  void SetOrigin(float x, float y);
92 
99 
105  void SetScale(const Vector2f& scale);
106 
113  void SetScale(float x, float y);
114 
120  void Scale(const Vector2f& scale);
121 
128  void Scale(float x, float y);
129 
135  float GetRotation();
136 
142  void SetRotation(float angle);
143 
149  void Rotate(float angle);
150 
151 protected:
155  float rotation;
156 };
157 SDLU_END
#define SDLU_BEGIN
Definition: Util.hpp:32
Provides a structure for simple vector calculations.
A class that stores locational information.
Definition: Transformable.hpp:21
void SetOrigin(const Vector2f &origin)
Sets a new local origin.
void SetPosition(const Vector2f &position)
Sets a new position.
void Scale(const Vector2f &scale)
Scales the object by some amount.
void SetPosition(float x, float y)
Sets a new position.
void Move(float x, float y)
Adds to the current position.
Vector2f position
Position of the object.
Definition: Transformable.hpp:152
float GetRotation()
Gets the current rotation.
void Move(const Vector2f &position)
Adds to the current position.
Vector2f GetPosition()
Returns the position of the object.
Vector2f scale
Scale of the object.
Definition: Transformable.hpp:154
Vector2f GetScale()
Gets the current scale of the object.
void SetRotation(float angle)
Sets a new rotation.
void SetScale(const Vector2f &scale)
Sets a new scale.
void SetOrigin(float x, float y)
Sets a new local origin.
void SetScale(float x, float y)
Sets a new scale.
void Scale(float x, float y)
Scales the object by some amount.
float rotation
Rotation of the object (in degrees)
Definition: Transformable.hpp:155
Vector2f origin
Offset of the top-left corner from the position.
Definition: Transformable.hpp:153
Transformable()
Default constructur.
Vector2f GetOrigin()
Gets the current local origin.
void Rotate(float angle)
Rotates by some amount.
virtual ~Transformable()
Deconstructor.