aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/math/transform.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-02-11 11:29:07 +0800
committerchai <chaifix@163.com>2020-02-11 11:29:07 +0800
commit160e1299ef3d95f8e8c48706d7f61dd3dc6c6b60 (patch)
treeabe5ae5242d9cc6caf6edf103e662c44e978fca0 /src/libjin/math/transform.cpp
parente095043485d1d298571af6d9eca7f0db9009ea7a (diff)
*修改 tab大小HEADmaster
Diffstat (limited to 'src/libjin/math/transform.cpp')
-rw-r--r--src/libjin/math/transform.cpp198
1 files changed, 99 insertions, 99 deletions
diff --git a/src/libjin/math/transform.cpp b/src/libjin/math/transform.cpp
index 84c8327..71e83e5 100644
--- a/src/libjin/math/transform.cpp
+++ b/src/libjin/math/transform.cpp
@@ -2,103 +2,103 @@
namespace JinEngine
{
- namespace Math
- {
-
- Transform::Transform()
- : mScale(1, 1)
- , mPosition(0, 0)
- , mOrigin(0, 0)
- , mRotation(0)
- {
- }
-
- Transform::Transform(float x, float y, float sx, float sy, float r, float ox, float oy)
- {
- set(x, y, sx, sy, r, ox, oy);
- }
-
- void Transform::set(float x, float y, float sx, float sy, float r, float ox, float oy)
- {
- setPosition(x, y);
- setScale(sx, sy);
- setRotation(r);
- setOrigin(ox, oy);
- }
-
- void Transform::setScale(float sx, float sy)
- {
- mScale.set(sx, sy);
- }
-
- Vector2<float> Transform::getScale() const
- {
- return mScale;
- }
-
- void Transform::scale(float sx, float sy)
- {
- mScale.x() *= sx;
- mScale.y() *= sy;
- }
-
- void Transform::setPosition(const Vector2<float>& p)
- {
- setPosition(p.x(), p.y());
- }
-
- void Transform::setPosition(float x, float y)
- {
- mPosition.set(x, y);
- }
-
- Vector2<float> Transform::getPosition() const
- {
- return mPosition;
- }
-
- void Transform::move(float x, float y)
- {
- mPosition.x() += x;
- mPosition.y() += y;
- }
-
- void Transform::move(const Vector2<float>& v)
- {
- move(v.x(), v.y());
- }
-
- void Transform::setOrigin(float x, float y)
- {
- mOrigin.set(x, y);
- }
-
- Vector2<float> Transform::getOrigin() const
- {
- return mOrigin;
- }
-
- void Transform::setRotation(float r)
- {
- mRotation = r;
- }
-
- float Transform::getRotation() const
- {
- return mRotation;
- }
-
- void Transform::rotate(float r)
- {
- mRotation += r;
- }
-
- Matrix Transform::getMatrix() const
- {
- Matrix m;
- m.setTransformation(mPosition.x(), mPosition.y(), mRotation, mScale.x(), mScale.y(), mOrigin.x(), mOrigin.y());
- return m;
- }
-
- }
+ namespace Math
+ {
+
+ Transform::Transform()
+ : mScale(1, 1)
+ , mPosition(0, 0)
+ , mOrigin(0, 0)
+ , mRotation(0)
+ {
+ }
+
+ Transform::Transform(float x, float y, float sx, float sy, float r, float ox, float oy)
+ {
+ set(x, y, sx, sy, r, ox, oy);
+ }
+
+ void Transform::set(float x, float y, float sx, float sy, float r, float ox, float oy)
+ {
+ setPosition(x, y);
+ setScale(sx, sy);
+ setRotation(r);
+ setOrigin(ox, oy);
+ }
+
+ void Transform::setScale(float sx, float sy)
+ {
+ mScale.set(sx, sy);
+ }
+
+ Vector2<float> Transform::getScale() const
+ {
+ return mScale;
+ }
+
+ void Transform::scale(float sx, float sy)
+ {
+ mScale.x() *= sx;
+ mScale.y() *= sy;
+ }
+
+ void Transform::setPosition(const Vector2<float>& p)
+ {
+ setPosition(p.x(), p.y());
+ }
+
+ void Transform::setPosition(float x, float y)
+ {
+ mPosition.set(x, y);
+ }
+
+ Vector2<float> Transform::getPosition() const
+ {
+ return mPosition;
+ }
+
+ void Transform::move(float x, float y)
+ {
+ mPosition.x() += x;
+ mPosition.y() += y;
+ }
+
+ void Transform::move(const Vector2<float>& v)
+ {
+ move(v.x(), v.y());
+ }
+
+ void Transform::setOrigin(float x, float y)
+ {
+ mOrigin.set(x, y);
+ }
+
+ Vector2<float> Transform::getOrigin() const
+ {
+ return mOrigin;
+ }
+
+ void Transform::setRotation(float r)
+ {
+ mRotation = r;
+ }
+
+ float Transform::getRotation() const
+ {
+ return mRotation;
+ }
+
+ void Transform::rotate(float r)
+ {
+ mRotation += r;
+ }
+
+ Matrix Transform::getMatrix() const
+ {
+ Matrix m;
+ m.setTransformation(mPosition.x(), mPosition.y(), mRotation, mScale.x(), mScale.y(), mOrigin.x(), mOrigin.y());
+ return m;
+ }
+
+ }
} \ No newline at end of file