From 8b00d67febf133e89f6a0bfabc41feed555dc4a9 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 12 Jan 2019 21:48:33 +0800 Subject: =?UTF-8?q?*=E5=8E=BB=E6=8E=89=E6=96=87=E4=BB=B6=E5=89=8D=E7=BC=80?= =?UTF-8?q?je=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/math/transform.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/libjin/math/transform.h (limited to 'src/libjin/math/transform.h') diff --git a/src/libjin/math/transform.h b/src/libjin/math/transform.h new file mode 100644 index 0000000..3f3c199 --- /dev/null +++ b/src/libjin/math/transform.h @@ -0,0 +1,50 @@ +#ifndef __JE_TRANSFORM_H__ +#define __JE_TRANSFORM_H__ + +#include "matrix.h" +#include "vector2.hpp" + +namespace JinEngine +{ + namespace Math + { + + class Transform + { + public: + Transform(); + Transform(float x, float y, float sx, float sy, float r, float ox, float oy); + + void set(float x, float y, float sx, float sy, float r, float ox, float oy); + + void setScale(float sx, float sy); + Vector2 getScale() const; + void scale(float sx, float sy); + + void setPosition(float x, float y); + void setPosition(const Vector2& p); + Vector2 getPosition() const; + void move(float x, float y); + void move(const Vector2& v); + + void setOrigin(float x, float y); + Vector2 getOrigin() const; + + void setRotation(float r); + float getRotation() const; + void rotate(float r); + + Matrix getMatrix() const; + + private: + Vector2 mPosition; + Vector2 mOrigin; + Vector2 mScale; + float mRotation; + + }; + + } +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0