63 lines
1,005 B
C++
63 lines
1,005 B
C++
|
|
#ifndef SPECTRE_GRAPHICS_TRANSFORMABLE_H
|
|
#define SPECTRE_GRAPHICS_TRANSFORMABLE_H
|
|
|
|
#include <Spectre/Math/Transform.h>
|
|
#include <Spectre/Math/Vector2.h>
|
|
|
|
namespace sp {
|
|
|
|
class Transformable
|
|
{
|
|
public :
|
|
Transformable();
|
|
|
|
Transformable(const Vector2f& position);
|
|
|
|
virtual ~Transformable();
|
|
|
|
// Position
|
|
|
|
void setPosition(const Vector2f& position);
|
|
|
|
void setPosition(float x, float y);
|
|
|
|
void move(const Vector2f& offset);
|
|
|
|
const Vector2f& getPosition() const;
|
|
|
|
// Rotation
|
|
|
|
void setRotation(float angle);
|
|
|
|
void rotate(float angle);
|
|
|
|
float getRotation() const;
|
|
|
|
// Scale
|
|
|
|
void setScale(const Vector2f& offset);
|
|
|
|
void setScale(float scale);
|
|
|
|
void scale(const Vector2f& offset);
|
|
|
|
void scale(float scale);
|
|
|
|
const Vector2f getScale() const;
|
|
|
|
const Transform& getTransform() const;
|
|
|
|
private :
|
|
|
|
Vector2f m_position;
|
|
float m_rotation;
|
|
Vector2f m_scale;
|
|
|
|
mutable bool m_transformNeedsUpdate;
|
|
mutable Transform m_transform;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* SPECTRE_GRAPHICS_TRANSFORMABLE_H */
|