diff --git a/core/Action/JumpBy.cpp b/core/Action/JumpBy.cpp index dacbbb2e..4898fad1 100644 --- a/core/Action/JumpBy.cpp +++ b/core/Action/JumpBy.cpp @@ -1,7 +1,7 @@ #include "..\e2daction.h" #include "..\e2dnode.h" -e2d::JumpBy::JumpBy(double duration, const Vector & vec, double height, int jumps) +e2d::JumpBy::JumpBy(double duration, const Vector2 & vec, double height, int jumps) : FiniteTimeAction(duration) , _deltaPos(vec) , _height(height) @@ -42,10 +42,10 @@ void e2d::JumpBy::_update() Point currentPos = _target->getPos(); - Vector diff = currentPos - _prevPos; + Vector2 diff = currentPos - _prevPos; _startPos = diff + _startPos; - Point newPos = _startPos + Vector(x, y); + Point newPos = _startPos + Vector2(x, y); _target->setPos(newPos); _prevPos = newPos; diff --git a/core/Action/MoveBy.cpp b/core/Action/MoveBy.cpp index 5d14588d..20328a44 100644 --- a/core/Action/MoveBy.cpp +++ b/core/Action/MoveBy.cpp @@ -2,7 +2,7 @@ #include "..\e2dnode.h" -e2d::MoveBy::MoveBy(double duration, Vector vector) +e2d::MoveBy::MoveBy(double duration, Vector2 vector) : FiniteTimeAction(duration) { _deltaPos = vector; @@ -25,7 +25,7 @@ void e2d::MoveBy::_update() if (_target) { Point currentPos = _target->getPos(); - Vector diff = currentPos - _prevPos; + Vector2 diff = currentPos - _prevPos; _startPos = _startPos + diff; Point newPos = _startPos + (_deltaPos * _delta); diff --git a/core/Action/MoveTo.cpp b/core/Action/MoveTo.cpp index b56d7e40..7691d19e 100644 --- a/core/Action/MoveTo.cpp +++ b/core/Action/MoveTo.cpp @@ -2,7 +2,7 @@ #include "..\e2dnode.h" e2d::MoveTo::MoveTo(double duration, Point pos) - : MoveBy(duration, Vector()) + : MoveBy(duration, Vector2()) { _endPos = pos; } diff --git a/core/Node/Node.cpp b/core/Node/Node.cpp index 61f68fa2..bdde3eaf 100644 --- a/core/Node/Node.cpp +++ b/core/Node/Node.cpp @@ -412,7 +412,7 @@ void e2d::Node::movePos(double x, double y) this->setPos(_posX + x, _posY + y); } -void e2d::Node::movePos(const Vector & v) +void e2d::Node::movePos(const Vector2 & v) { this->movePos(v.x, v.y); } diff --git a/core/Transition/MoveTransition.cpp b/core/Transition/MoveTransition.cpp index 88f1dc36..a431344b 100644 --- a/core/Transition/MoveTransition.cpp +++ b/core/Transition/MoveTransition.cpp @@ -15,22 +15,22 @@ void e2d::MoveTransition::_init(Scene * prev, Scene * next) double height = _windowSize.height; if (_direction == Direction::Up) { - _posDelta = Vector(0, -height); + _posDelta = Vector2(0, -height); _startPos = Point(0, height); } else if (_direction == Direction::Down) { - _posDelta = Vector(0, height); + _posDelta = Vector2(0, height); _startPos = Point(0, -height); } else if (_direction == Direction::Left) { - _posDelta = Vector(-width, 0); + _posDelta = Vector2(-width, 0); _startPos = Point(width, 0); } else if (_direction == Direction::Right) { - _posDelta = Vector(width, 0); + _posDelta = Vector2(width, 0); _startPos = Point(-width, 0); } diff --git a/core/e2daction.h b/core/e2daction.h index 611126e6..c0d92928 100644 --- a/core/e2daction.h +++ b/core/e2daction.h @@ -126,7 +126,7 @@ class MoveBy : public: explicit MoveBy( double duration, /* 持续时长 */ - Vector vector /* 移动距离 */ + Vector2 vector /* 移动距离 */ ); // 获取该动作的拷贝对象 @@ -145,7 +145,7 @@ protected: protected: Point _startPos; Point _prevPos; - Vector _deltaPos; + Vector2 _deltaPos; }; @@ -185,7 +185,7 @@ class JumpBy : public: explicit JumpBy( double duration, /* 持续时长 */ - const Vector& vec, /* 跳跃距离 */ + const Vector2& vec, /* 跳跃距离 */ double height, /* 跳跃高度 */ int jumps = 1 /* 跳跃次数 */ ); @@ -205,7 +205,7 @@ protected: protected: Point _startPos; - Vector _deltaPos; + Vector2 _deltaPos; double _height; int _jumps; Point _prevPos; diff --git a/core/e2dcommon.h b/core/e2dcommon.h index e5cf4ecc..3b212a7e 100644 --- a/core/e2dcommon.h +++ b/core/e2dcommon.h @@ -55,7 +55,7 @@ public: // 二维向量 -typedef Point Vector; +typedef Point Vector2; // 大小 diff --git a/core/e2dnode.h b/core/e2dnode.h index 1bb736f7..394bb3f9 100644 --- a/core/e2dnode.h +++ b/core/e2dnode.h @@ -224,7 +224,7 @@ public: // 移动节点 virtual void movePos( - const Vector & v + const Vector2 & v ); // 设置节点绘图顺序 diff --git a/core/e2dtransition.h b/core/e2dtransition.h index 84f693c9..63dd0ec2 100644 --- a/core/e2dtransition.h +++ b/core/e2dtransition.h @@ -151,7 +151,7 @@ protected: protected: Direction _direction; - Vector _posDelta; + Vector2 _posDelta; Point _startPos; };