Vector更名为Vector2
This commit is contained in:
parent
372bc09773
commit
95e77d6f0d
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "..\e2dnode.h"
|
||||
|
||||
e2d::MoveTo::MoveTo(double duration, Point pos)
|
||||
: MoveBy(duration, Vector())
|
||||
: MoveBy(duration, Vector2())
|
||||
{
|
||||
_endPos = pos;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
|
||||
// 二维向量
|
||||
typedef Point Vector;
|
||||
typedef Point Vector2;
|
||||
|
||||
|
||||
// 大小
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public:
|
|||
|
||||
// 移动节点
|
||||
virtual void movePos(
|
||||
const Vector & v
|
||||
const Vector2 & v
|
||||
);
|
||||
|
||||
// 设置节点绘图顺序
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ protected:
|
|||
|
||||
protected:
|
||||
Direction _direction;
|
||||
Vector _posDelta;
|
||||
Vector2 _posDelta;
|
||||
Point _startPos;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue