add: TweenAction
refactoring TweenAction(s) & remove CallFunc & rename Animation to Frames
This commit is contained in:
parent
ab2c6092e8
commit
00ee7002f3
|
|
@ -53,9 +53,7 @@ namespace easy2d
|
|||
virtual void Pause() { running_ = false; }
|
||||
|
||||
// 停止动作
|
||||
virtual void Stop() { done_ = true; }
|
||||
|
||||
virtual bool IsDone() const { return done_; }
|
||||
virtual void Stop() { if (!done_) { done_ = true; cb_(); } }
|
||||
|
||||
// 获取动作的拷贝
|
||||
virtual spAction Clone() const = 0;
|
||||
|
|
@ -70,6 +68,11 @@ namespace easy2d
|
|||
done_ = false;
|
||||
}
|
||||
|
||||
// 设置动作结束时的回调函数
|
||||
void SetCallback(std::function<void()> cb) { cb_ = cb; }
|
||||
|
||||
virtual bool IsDone() const { return done_; }
|
||||
|
||||
protected:
|
||||
virtual void Start()
|
||||
{
|
||||
|
|
@ -91,5 +94,6 @@ namespace easy2d
|
|||
bool running_;
|
||||
bool done_;
|
||||
bool initialized_;
|
||||
std::function<void()> cb_;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,54 +18,125 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "ActionInterval.h"
|
||||
#include "ActionTween.h"
|
||||
#include "Geometry.h"
|
||||
#include "base.hpp"
|
||||
#include "Node.h"
|
||||
#include "../math/ease.hpp"
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
// IntervalAction
|
||||
// Tween
|
||||
//-------------------------------------------------------
|
||||
|
||||
IntervalAction::IntervalAction(Duration const& duration)
|
||||
: process_(0)
|
||||
, duration_(duration)
|
||||
Tween::Tween()
|
||||
: elapsed_()
|
||||
, duration_()
|
||||
, ease_func_(math::Linear)
|
||||
, ease_type_(EaseFunc::Linear)
|
||||
{
|
||||
}
|
||||
|
||||
void IntervalAction::Reset()
|
||||
Tween::Tween(Duration const& duration, EaseFunc func)
|
||||
: elapsed_()
|
||||
, ease_func_(math::Linear)
|
||||
, ease_type_(EaseFunc::Linear)
|
||||
{
|
||||
SetDuration(duration);
|
||||
SetEaseFunction(func);
|
||||
}
|
||||
|
||||
void Tween::SetEaseFunction(EaseFunc func)
|
||||
{
|
||||
ease_type_ = func;
|
||||
switch (func)
|
||||
{
|
||||
case EaseFunc::Linear:
|
||||
ease_func_ = math::Linear;
|
||||
break;
|
||||
case EaseFunc::EaseIn:
|
||||
ease_func_ = std::bind(math::EaseIn, std::placeholders::_1, 2.f);
|
||||
break;
|
||||
case EaseFunc::EaseOut:
|
||||
ease_func_ = std::bind(math::EaseOut, std::placeholders::_1, 2.f);
|
||||
break;
|
||||
case EaseFunc::EaseInOut:
|
||||
ease_func_ = std::bind(math::EaseInOut, std::placeholders::_1, 2.f);
|
||||
break;
|
||||
case EaseFunc::EaseExponentialIn:
|
||||
ease_func_ = math::EaseExponentialIn;
|
||||
break;
|
||||
case EaseFunc::EaseExponentialOut:
|
||||
ease_func_ = math::EaseExponentialOut;
|
||||
break;
|
||||
case EaseFunc::EaseExponentialInOut:
|
||||
ease_func_ = math::EaseExponentialInOut;
|
||||
break;
|
||||
case EaseFunc::EaseSineIn:
|
||||
ease_func_ = math::EaseSineIn;
|
||||
break;
|
||||
case EaseFunc::EaseSineOut:
|
||||
ease_func_ = math::EaseSineOut;
|
||||
break;
|
||||
case EaseFunc::EaseSineInOut:
|
||||
ease_func_ = math::EaseSineInOut;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tween::SetEaseFunction(std::function<float(float)> func)
|
||||
{
|
||||
ease_func_ = func;
|
||||
ease_type_ = EaseFunc(-1);
|
||||
}
|
||||
|
||||
void Tween::Reset()
|
||||
{
|
||||
Action::Reset();
|
||||
process_ = 0;
|
||||
elapsed_ = Duration{};
|
||||
}
|
||||
|
||||
void IntervalAction::Init(Node* target)
|
||||
Duration const & Tween::GetDuration() const
|
||||
{
|
||||
return duration_;
|
||||
}
|
||||
|
||||
void Tween::Init(Node* target)
|
||||
{
|
||||
Action::Init(target);
|
||||
}
|
||||
|
||||
void IntervalAction::Update(Node* target, Duration const& dt)
|
||||
void Tween::Update(Node* target, Duration const& dt)
|
||||
{
|
||||
Action::Update(target, dt);
|
||||
|
||||
float step;
|
||||
if (duration_.IsZero())
|
||||
{
|
||||
process_ = 1.f;
|
||||
this->Stop();
|
||||
step = 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
process_ += dt / duration_;
|
||||
process_ = std::min(process_, 1.f);
|
||||
elapsed_ += dt;
|
||||
step = std::min(elapsed_ / duration_, 1.f);
|
||||
}
|
||||
|
||||
if (process_ >= 1)
|
||||
if ((1.f - step) <= FLT_EPSILON)
|
||||
{
|
||||
this->Stop();
|
||||
}
|
||||
|
||||
UpdateStep(target, ease_func_(step));
|
||||
}
|
||||
|
||||
void Tween::SetDuration(Duration const & duration)
|
||||
{
|
||||
duration_ = duration;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -73,15 +144,15 @@ namespace easy2d
|
|||
// Move Action
|
||||
//-------------------------------------------------------
|
||||
|
||||
MoveBy::MoveBy(Duration const& duration, Point const& vector)
|
||||
: IntervalAction(duration)
|
||||
MoveBy::MoveBy(Duration const& duration, Point const& vector, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
{
|
||||
delta_pos_ = vector;
|
||||
}
|
||||
|
||||
void MoveBy::Init(Node* target)
|
||||
{
|
||||
IntervalAction::Init(target);
|
||||
Tween::Init(target);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
|
@ -89,16 +160,14 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void MoveBy::Update(Node* target, Duration const& dt)
|
||||
void MoveBy::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
Point diff = target->GetPosition() - prev_pos_;
|
||||
start_pos_ = start_pos_ + diff;
|
||||
|
||||
Point new_pos = start_pos_ + (delta_pos_ * process_);
|
||||
Point new_pos = start_pos_ + (delta_pos_ * step);
|
||||
target->SetPosition(new_pos);
|
||||
|
||||
prev_pos_ = new_pos;
|
||||
|
|
@ -107,23 +176,23 @@ namespace easy2d
|
|||
|
||||
spAction MoveBy::Clone() const
|
||||
{
|
||||
return new (std::nothrow) MoveBy(duration_, delta_pos_);
|
||||
return new (std::nothrow) MoveBy(duration_, delta_pos_, ease_type_);
|
||||
}
|
||||
|
||||
spAction MoveBy::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) MoveBy(duration_, -delta_pos_);
|
||||
return new (std::nothrow) MoveBy(duration_, -delta_pos_, ease_type_);
|
||||
}
|
||||
|
||||
MoveTo::MoveTo(Duration const& duration, Point const& pos)
|
||||
: MoveBy(duration, Point())
|
||||
MoveTo::MoveTo(Duration const& duration, Point const& pos, EaseFunc func)
|
||||
: MoveBy(duration, Point(), func)
|
||||
{
|
||||
end_pos_ = pos;
|
||||
}
|
||||
|
||||
spAction MoveTo::Clone() const
|
||||
{
|
||||
return new (std::nothrow) MoveTo(duration_, end_pos_);
|
||||
return new (std::nothrow) MoveTo(duration_, end_pos_, ease_type_);
|
||||
}
|
||||
|
||||
void MoveTo::Init(Node* target)
|
||||
|
|
@ -137,8 +206,8 @@ namespace easy2d
|
|||
// Jump Action
|
||||
//-------------------------------------------------------
|
||||
|
||||
JumpBy::JumpBy(Duration const& duration, Point const& vec, float height, int jumps)
|
||||
: IntervalAction(duration)
|
||||
JumpBy::JumpBy(Duration const& duration, Point const& vec, float height, int jumps, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
, delta_pos_(vec)
|
||||
, height_(height)
|
||||
, jumps_(jumps)
|
||||
|
|
@ -147,17 +216,17 @@ namespace easy2d
|
|||
|
||||
spAction JumpBy::Clone() const
|
||||
{
|
||||
return new (std::nothrow) JumpBy(duration_, delta_pos_, height_, jumps_);
|
||||
return new (std::nothrow) JumpBy(duration_, delta_pos_, height_, jumps_, ease_type_);
|
||||
}
|
||||
|
||||
spAction JumpBy::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) JumpBy(duration_, -delta_pos_, height_, jumps_);
|
||||
return new (std::nothrow) JumpBy(duration_, -delta_pos_, height_, jumps_, ease_type_);
|
||||
}
|
||||
|
||||
void JumpBy::Init(Node* target)
|
||||
{
|
||||
IntervalAction::Init(target);
|
||||
Tween::Init(target);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
|
@ -165,16 +234,14 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void JumpBy::Update(Node* target, Duration const& dt)
|
||||
void JumpBy::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
float frac = fmod(process_ * jumps_, 1.f);
|
||||
float x = delta_pos_.x * process_;
|
||||
float frac = fmod(step * jumps_, 1.f);
|
||||
float x = delta_pos_.x * step;
|
||||
float y = height_ * 4 * frac * (1 - frac);
|
||||
y += delta_pos_.y * process_;
|
||||
y += delta_pos_.y * step;
|
||||
|
||||
Point diff = target->GetPosition() - prev_pos_;
|
||||
start_pos_ = diff + start_pos_;
|
||||
|
|
@ -186,15 +253,15 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
JumpTo::JumpTo(Duration const& duration, Point const& pos, float height, int jumps)
|
||||
: JumpBy(duration, Point(), height, jumps)
|
||||
JumpTo::JumpTo(Duration const& duration, Point const& pos, float height, int jumps, EaseFunc func)
|
||||
: JumpBy(duration, Point(), height, jumps, func)
|
||||
, end_pos_(pos)
|
||||
{
|
||||
}
|
||||
|
||||
spAction JumpTo::Clone() const
|
||||
{
|
||||
return new (std::nothrow) JumpTo(duration_, end_pos_, height_, jumps_);
|
||||
return new (std::nothrow) JumpTo(duration_, end_pos_, height_, jumps_, ease_type_);
|
||||
}
|
||||
|
||||
void JumpTo::Init(Node* target)
|
||||
|
|
@ -208,15 +275,15 @@ namespace easy2d
|
|||
// Scale Action
|
||||
//-------------------------------------------------------
|
||||
|
||||
ScaleBy::ScaleBy(Duration const& duration, float scale)
|
||||
: IntervalAction(duration)
|
||||
ScaleBy::ScaleBy(Duration const& duration, float scale, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
{
|
||||
delta_x_ = scale;
|
||||
delta_y_ = scale;
|
||||
}
|
||||
|
||||
ScaleBy::ScaleBy(Duration const& duration, float scale_x, float scale_y)
|
||||
: IntervalAction(duration)
|
||||
ScaleBy::ScaleBy(Duration const& duration, float scale_x, float scale_y, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
{
|
||||
delta_x_ = scale_x;
|
||||
delta_y_ = scale_y;
|
||||
|
|
@ -224,7 +291,7 @@ namespace easy2d
|
|||
|
||||
void ScaleBy::Init(Node* target)
|
||||
{
|
||||
IntervalAction::Init(target);
|
||||
Tween::Init(target);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
|
@ -233,35 +300,33 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void ScaleBy::Update(Node* target, Duration const& dt)
|
||||
void ScaleBy::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->SetScale(start_scale_x_ + delta_x_ * process_, start_scale_y_ + delta_y_ * process_);
|
||||
target->SetScale(start_scale_x_ + delta_x_ * step, start_scale_y_ + delta_y_ * step);
|
||||
}
|
||||
}
|
||||
|
||||
spAction ScaleBy::Clone() const
|
||||
{
|
||||
return new (std::nothrow) ScaleBy(duration_, delta_x_, delta_y_);
|
||||
return new (std::nothrow) ScaleBy(duration_, delta_x_, delta_y_, ease_type_);
|
||||
}
|
||||
|
||||
spAction ScaleBy::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) ScaleBy(duration_, -delta_x_, -delta_y_);
|
||||
return new (std::nothrow) ScaleBy(duration_, -delta_x_, -delta_y_, ease_type_);
|
||||
}
|
||||
|
||||
ScaleTo::ScaleTo(Duration const& duration, float scale)
|
||||
: ScaleBy(duration, 0, 0)
|
||||
ScaleTo::ScaleTo(Duration const& duration, float scale, EaseFunc func)
|
||||
: ScaleBy(duration, 0, 0, func)
|
||||
{
|
||||
end_scale_x_ = scale;
|
||||
end_scale_y_ = scale;
|
||||
}
|
||||
|
||||
ScaleTo::ScaleTo(Duration const& duration, float scale_x, float scale_y)
|
||||
: ScaleBy(duration, 0, 0)
|
||||
ScaleTo::ScaleTo(Duration const& duration, float scale_x, float scale_y, EaseFunc func)
|
||||
: ScaleBy(duration, 0, 0, func)
|
||||
{
|
||||
end_scale_x_ = scale_x;
|
||||
end_scale_y_ = scale_y;
|
||||
|
|
@ -269,7 +334,7 @@ namespace easy2d
|
|||
|
||||
spAction ScaleTo::Clone() const
|
||||
{
|
||||
return new (std::nothrow) ScaleTo(duration_, end_scale_x_, end_scale_y_);
|
||||
return new (std::nothrow) ScaleTo(duration_, end_scale_x_, end_scale_y_, ease_type_);
|
||||
}
|
||||
|
||||
void ScaleTo::Init(Node* target)
|
||||
|
|
@ -284,15 +349,15 @@ namespace easy2d
|
|||
// Opacity Action
|
||||
//-------------------------------------------------------
|
||||
|
||||
OpacityBy::OpacityBy(Duration const& duration, float opacity)
|
||||
: IntervalAction(duration)
|
||||
OpacityBy::OpacityBy(Duration const& duration, float opacity, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
{
|
||||
delta_val_ = opacity;
|
||||
}
|
||||
|
||||
void OpacityBy::Init(Node* target)
|
||||
{
|
||||
IntervalAction::Init(target);
|
||||
Tween::Init(target);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
|
@ -300,35 +365,33 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void OpacityBy::Update(Node* target, Duration const& dt)
|
||||
void OpacityBy::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->SetOpacity(start_val_ + delta_val_ * process_);
|
||||
target->SetOpacity(start_val_ + delta_val_ * step);
|
||||
}
|
||||
}
|
||||
|
||||
spAction OpacityBy::Clone() const
|
||||
{
|
||||
return new (std::nothrow) OpacityBy(duration_, delta_val_);
|
||||
return new (std::nothrow) OpacityBy(duration_, delta_val_, ease_type_);
|
||||
}
|
||||
|
||||
spAction OpacityBy::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) OpacityBy(duration_, -delta_val_);
|
||||
return new (std::nothrow) OpacityBy(duration_, -delta_val_, ease_type_);
|
||||
}
|
||||
|
||||
OpacityTo::OpacityTo(Duration const& duration, float opacity)
|
||||
: OpacityBy(duration, 0)
|
||||
OpacityTo::OpacityTo(Duration const& duration, float opacity, EaseFunc func)
|
||||
: OpacityBy(duration, 0, func)
|
||||
{
|
||||
end_val_ = opacity;
|
||||
}
|
||||
|
||||
spAction OpacityTo::Clone() const
|
||||
{
|
||||
return new (std::nothrow) OpacityTo(duration_, end_val_);
|
||||
return new (std::nothrow) OpacityTo(duration_, end_val_, ease_type_);
|
||||
}
|
||||
|
||||
void OpacityTo::Init(Node* target)
|
||||
|
|
@ -337,13 +400,13 @@ namespace easy2d
|
|||
delta_val_ = end_val_ - start_val_;
|
||||
}
|
||||
|
||||
FadeIn::FadeIn(Duration const& duration)
|
||||
: OpacityTo(duration, 1)
|
||||
FadeIn::FadeIn(Duration const& duration, EaseFunc func)
|
||||
: OpacityTo(duration, 1, func)
|
||||
{
|
||||
}
|
||||
|
||||
FadeOut::FadeOut(Duration const& duration)
|
||||
: OpacityTo(duration, 0)
|
||||
FadeOut::FadeOut(Duration const& duration, EaseFunc func)
|
||||
: OpacityTo(duration, 0, func)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -352,15 +415,15 @@ namespace easy2d
|
|||
// Rotate Action
|
||||
//-------------------------------------------------------
|
||||
|
||||
RotateBy::RotateBy(Duration const& duration, float rotation)
|
||||
: IntervalAction(duration)
|
||||
RotateBy::RotateBy(Duration const& duration, float rotation, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
, delta_val_(rotation)
|
||||
{
|
||||
}
|
||||
|
||||
void RotateBy::Init(Node* target)
|
||||
{
|
||||
IntervalAction::Init(target);
|
||||
Tween::Init(target);
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
|
@ -368,35 +431,33 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void RotateBy::Update(Node* target, Duration const& dt)
|
||||
void RotateBy::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->SetRotation(start_val_ + delta_val_ * process_);
|
||||
target->SetRotation(start_val_ + delta_val_ * step);
|
||||
}
|
||||
}
|
||||
|
||||
spAction RotateBy::Clone() const
|
||||
{
|
||||
return new (std::nothrow) RotateBy(duration_, delta_val_);
|
||||
return new (std::nothrow) RotateBy(duration_, delta_val_, ease_type_);
|
||||
}
|
||||
|
||||
spAction RotateBy::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) RotateBy(duration_, -delta_val_);
|
||||
return new (std::nothrow) RotateBy(duration_, -delta_val_, ease_type_);
|
||||
}
|
||||
|
||||
RotateTo::RotateTo(Duration const& duration, float rotation)
|
||||
: RotateBy(duration, 0)
|
||||
RotateTo::RotateTo(Duration const& duration, float rotation, EaseFunc func)
|
||||
: RotateBy(duration, 0, func)
|
||||
{
|
||||
end_val_ = rotation;
|
||||
}
|
||||
|
||||
spAction RotateTo::Clone() const
|
||||
{
|
||||
return new (std::nothrow) RotateTo(duration_, end_val_);
|
||||
return new (std::nothrow) RotateTo(duration_, end_val_, ease_type_);
|
||||
}
|
||||
|
||||
void RotateTo::Init(Node* target)
|
||||
|
|
@ -410,8 +471,8 @@ namespace easy2d
|
|||
// PathAction
|
||||
//-------------------------------------------------------
|
||||
|
||||
PathAction::PathAction(Duration const & duration, spGeometry const& geo, bool rotating, float start, float end)
|
||||
: IntervalAction(duration)
|
||||
PathAction::PathAction(Duration const & duration, spGeometry const& geo, bool rotating, float start, float end, EaseFunc func)
|
||||
: Tween(duration, func)
|
||||
, start_(start)
|
||||
, end_(end)
|
||||
, geo_(geo)
|
||||
|
|
@ -421,22 +482,20 @@ namespace easy2d
|
|||
|
||||
spAction PathAction::Clone() const
|
||||
{
|
||||
return new PathAction(duration_, geo_, rotating_, start_, end_);
|
||||
return new PathAction(duration_, geo_, rotating_, start_, end_, ease_type_);
|
||||
}
|
||||
|
||||
spAction PathAction::Reverse() const
|
||||
{
|
||||
return new PathAction(duration_, geo_, rotating_, end_, start_);
|
||||
return new PathAction(duration_, geo_, rotating_, end_, start_, ease_type_);
|
||||
}
|
||||
|
||||
void PathAction::Update(Node * target, Duration const & dt)
|
||||
void PathAction::UpdateStep(Node* target, float step)
|
||||
{
|
||||
IntervalAction::Update(target, dt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
float percent = std::min(std::max((end_ - start_) * process_ + start_, 0.f), 1.f);
|
||||
float length = geo_->GetLength() * percent;
|
||||
float length = geo_->GetLength() * std::min(std::max((end_ - start_) * step + start_, 0.f), 1.f);
|
||||
|
||||
Point point, tangent;
|
||||
if (geo_->ComputePointAt(length, &point, &tangent))
|
||||
{
|
||||
|
|
@ -452,48 +511,4 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Delay
|
||||
//-------------------------------------------------------
|
||||
|
||||
Delay::Delay(Duration const& duration)
|
||||
: delta_()
|
||||
, delay_(duration)
|
||||
{
|
||||
}
|
||||
|
||||
void Delay::Reset()
|
||||
{
|
||||
Action::Reset();
|
||||
delta_ = Duration{};
|
||||
}
|
||||
|
||||
void Delay::Init(Node* target)
|
||||
{
|
||||
Action::Init(target);
|
||||
}
|
||||
|
||||
void Delay::Update(Node* target, Duration const& dt)
|
||||
{
|
||||
Action::Update(target, dt);
|
||||
|
||||
delta_ += dt;
|
||||
|
||||
if (delta_ >= delay_)
|
||||
{
|
||||
this->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
spAction Delay::Clone() const
|
||||
{
|
||||
return new (std::nothrow) Delay(delay_);
|
||||
}
|
||||
|
||||
spAction Delay::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) Delay(delay_);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,35 +24,71 @@
|
|||
|
||||
namespace easy2d
|
||||
{
|
||||
class IntervalAction
|
||||
enum class EaseFunc
|
||||
{
|
||||
Linear, // 线性
|
||||
EaseIn, // 由慢变快
|
||||
EaseOut, // 由快变慢
|
||||
EaseInOut, // 由慢变快, 再由快变慢
|
||||
EaseExponentialIn, // 由慢变极快
|
||||
EaseExponentialOut, // 由极快变慢
|
||||
EaseExponentialInOut, // 由慢至极快, 再由极快边慢
|
||||
EaseSineIn, // 由快变慢, 采用正弦变换速度
|
||||
EaseSineOut, // 由慢变快, 采用正弦变换速度
|
||||
EaseSineInOut // 由慢至快, 再由快至慢, 采用正弦变换速度
|
||||
};
|
||||
|
||||
class Tween
|
||||
: public Action
|
||||
{
|
||||
public:
|
||||
explicit IntervalAction(
|
||||
Duration const& duration
|
||||
Tween();
|
||||
|
||||
explicit Tween(
|
||||
Duration const& duration,
|
||||
EaseFunc func
|
||||
);
|
||||
|
||||
// 设置速度变化曲线
|
||||
void SetEaseFunction(
|
||||
EaseFunc func
|
||||
);
|
||||
|
||||
// 自定义速度变化曲线
|
||||
void SetEaseFunction(
|
||||
std::function<float(float)> func
|
||||
);
|
||||
|
||||
virtual void Reset() override;
|
||||
|
||||
Duration const& GetDuration() const;
|
||||
|
||||
void SetDuration(Duration const& duration);
|
||||
|
||||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
|
||||
virtual void UpdateStep(Node* target, float step) = 0;
|
||||
|
||||
protected:
|
||||
Duration duration_;
|
||||
float process_;
|
||||
Duration elapsed_;
|
||||
EaseFunc ease_type_;
|
||||
std::function<float(float)> ease_func_;
|
||||
};
|
||||
|
||||
|
||||
// 相对位移动作
|
||||
class MoveBy
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit MoveBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
Point const& vector /* 移动距离 */
|
||||
Point const& vector, /* 移动距离 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -64,7 +100,7 @@ namespace easy2d
|
|||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
Point start_pos_;
|
||||
|
|
@ -80,7 +116,8 @@ namespace easy2d
|
|||
public:
|
||||
explicit MoveTo(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
Point const& pos /* 目的坐标 */
|
||||
Point const& pos, /* 目的坐标 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -103,14 +140,15 @@ namespace easy2d
|
|||
|
||||
// 相对跳跃动作
|
||||
class JumpBy
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit JumpBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
Point const& vec, /* 跳跃距离 */
|
||||
float height, /* 跳跃高度 */
|
||||
int jumps = 1 /* 跳跃次数 */
|
||||
int jumps = 1, /* 跳跃次数 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -122,7 +160,7 @@ namespace easy2d
|
|||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
Point start_pos_;
|
||||
|
|
@ -142,7 +180,8 @@ namespace easy2d
|
|||
Duration const& duration, /* 持续时长 */
|
||||
Point const& pos, /* 目的坐标 */
|
||||
float height, /* 跳跃高度 */
|
||||
int jumps = 1 /* 跳跃次数 */
|
||||
int jumps = 1, /* 跳跃次数 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -165,18 +204,20 @@ namespace easy2d
|
|||
|
||||
// 相对缩放动作
|
||||
class ScaleBy
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit ScaleBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float scale /* 相对变化值 */
|
||||
float scale, /* 相对变化值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
explicit ScaleBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float scale_x, /* 横向缩放相对变化值 */
|
||||
float scale_y /* 纵向缩放相对变化值 */
|
||||
float scale_y, /* 纵向缩放相对变化值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -188,7 +229,7 @@ namespace easy2d
|
|||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
float start_scale_x_;
|
||||
|
|
@ -205,13 +246,15 @@ namespace easy2d
|
|||
public:
|
||||
explicit ScaleTo(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float scale /* 目标值 */
|
||||
float scale, /* 目标值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
explicit ScaleTo(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float scale_x, /* 横向缩放目标值 */
|
||||
float scale_y /* 纵向缩放目标值 */
|
||||
float scale_y, /* 纵向缩放目标值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -235,12 +278,13 @@ namespace easy2d
|
|||
|
||||
// 透明度相对渐变动作
|
||||
class OpacityBy
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit OpacityBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float opacity /* 相对变化值 */
|
||||
float opacity, /* 相对变化值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -252,7 +296,7 @@ namespace easy2d
|
|||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
float start_val_;
|
||||
|
|
@ -267,7 +311,8 @@ namespace easy2d
|
|||
public:
|
||||
explicit OpacityTo(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float opacity /* 目标值 */
|
||||
float opacity, /* 目标值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -295,7 +340,8 @@ namespace easy2d
|
|||
public:
|
||||
// 创建淡入动作
|
||||
explicit FadeIn(
|
||||
Duration const& duration /* 持续时长 */
|
||||
Duration const& duration, /* 持续时长 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -307,19 +353,21 @@ namespace easy2d
|
|||
public:
|
||||
// 创建淡出动作
|
||||
explicit FadeOut(
|
||||
Duration const& duration /* 持续时长 */
|
||||
Duration const& duration, /* 持续时长 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// 相对旋转动作
|
||||
class RotateBy
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit RotateBy(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float rotation /* 相对变化值 */
|
||||
float rotation, /* 相对变化值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -331,7 +379,7 @@ namespace easy2d
|
|||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
float start_val_;
|
||||
|
|
@ -346,7 +394,8 @@ namespace easy2d
|
|||
public:
|
||||
explicit RotateTo(
|
||||
Duration const& duration, /* 持续时长 */
|
||||
float rotation /* 目标值 */
|
||||
float rotation, /* 目标值 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -369,7 +418,7 @@ namespace easy2d
|
|||
|
||||
// 路径动作
|
||||
class PathAction
|
||||
: public IntervalAction
|
||||
: public Tween
|
||||
{
|
||||
public:
|
||||
explicit PathAction(
|
||||
|
|
@ -377,7 +426,8 @@ namespace easy2d
|
|||
spGeometry const& geo, /* 几何图形 */
|
||||
bool rotating = false, /* 沿路径切线方向旋转 */
|
||||
float start = 0.f, /* 起点 */
|
||||
float end = 1.f /* 终点 */
|
||||
float end = 1.f, /* 终点 */
|
||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -387,7 +437,7 @@ namespace easy2d
|
|||
virtual spAction Reverse() const override;
|
||||
|
||||
protected:
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
virtual void UpdateStep(Node* target, float step) override;
|
||||
|
||||
protected:
|
||||
bool rotating_;
|
||||
|
|
@ -395,33 +445,4 @@ namespace easy2d
|
|||
float end_;
|
||||
spGeometry geo_;
|
||||
};
|
||||
|
||||
|
||||
// 延时动作
|
||||
class Delay
|
||||
: public Action
|
||||
{
|
||||
public:
|
||||
explicit Delay(
|
||||
Duration const& duration /* 延迟时长(秒) */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
virtual spAction Clone() const override;
|
||||
|
||||
// 获取该动作的倒转
|
||||
virtual spAction Reverse() const override;
|
||||
|
||||
// 重置动作
|
||||
virtual void Reset() override;
|
||||
|
||||
protected:
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
|
||||
protected:
|
||||
Duration delay_;
|
||||
Duration delta_;
|
||||
};
|
||||
}
|
||||
|
|
@ -19,73 +19,69 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include "Animation.h"
|
||||
#include "Frames.h"
|
||||
#include "Image.h"
|
||||
#include "Sprite.h"
|
||||
#include "logs.h"
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
// Animate
|
||||
//-------------------------------------------------------
|
||||
|
||||
Animate::Animate()
|
||||
Animation::Animation()
|
||||
: frame_index_(0)
|
||||
, animation_(nullptr)
|
||||
, frames_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Animate::Animate(spAnimation const& animation)
|
||||
Animation::Animation(spFrames const& animation)
|
||||
: frame_index_(0)
|
||||
, animation_(nullptr)
|
||||
, frames_(nullptr)
|
||||
{
|
||||
this->SetAnimation(animation);
|
||||
}
|
||||
|
||||
Animate::~Animate()
|
||||
Animation::~Animation()
|
||||
{
|
||||
}
|
||||
|
||||
spAnimation Animate::GetAnimation() const
|
||||
spFrames Animation::GetAnimation() const
|
||||
{
|
||||
return animation_;
|
||||
return frames_;
|
||||
}
|
||||
|
||||
void Animate::SetAnimation(spAnimation const& animation)
|
||||
void Animation::SetAnimation(spFrames const& animation)
|
||||
{
|
||||
if (animation && animation != animation_)
|
||||
if (animation && animation != frames_)
|
||||
{
|
||||
animation_ = animation;
|
||||
frames_ = animation;
|
||||
frame_index_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Animate::Init(Node* target)
|
||||
void Animation::Init(Node* target)
|
||||
{
|
||||
Action::Init(target);
|
||||
|
||||
auto sprite_target = dynamic_cast<Sprite*>(target);
|
||||
if (sprite_target && animation_)
|
||||
if (sprite_target && frames_)
|
||||
{
|
||||
sprite_target->Load(animation_->GetFrames()[frame_index_]);
|
||||
sprite_target->Load(frames_->GetFrames()[frame_index_]);
|
||||
++frame_index_;
|
||||
}
|
||||
}
|
||||
|
||||
void Animate::Update(Node* target, Duration const& dt)
|
||||
void Animation::Update(Node* target, Duration const& dt)
|
||||
{
|
||||
Action::Update(target, dt);
|
||||
|
||||
if (!animation_)
|
||||
if (!frames_)
|
||||
{
|
||||
this->Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
delta_ += dt;
|
||||
while (delta_ >= animation_->GetInterval())
|
||||
while (delta_ >= frames_->GetInterval())
|
||||
{
|
||||
auto& frames = animation_->GetFrames();
|
||||
auto& frames = frames_->GetFrames();
|
||||
auto sprite_target = dynamic_cast<Sprite*>(target);
|
||||
|
||||
if (sprite_target)
|
||||
|
|
@ -93,7 +89,7 @@ namespace easy2d
|
|||
sprite_target->Load(frames[frame_index_]);
|
||||
}
|
||||
|
||||
delta_ -= animation_->GetInterval();
|
||||
delta_ -= frames_->GetInterval();
|
||||
++frame_index_;
|
||||
|
||||
if (frame_index_ == frames.size())
|
||||
|
|
@ -104,123 +100,32 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void Animate::Reset()
|
||||
void Animation::Reset()
|
||||
{
|
||||
Action::Reset();
|
||||
frame_index_ = 0;
|
||||
}
|
||||
|
||||
spAction Animate::Clone() const
|
||||
spAction Animation::Clone() const
|
||||
{
|
||||
if (animation_)
|
||||
if (frames_)
|
||||
{
|
||||
return new (std::nothrow) Animate(animation_);
|
||||
return new (std::nothrow) Animation(frames_);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
spAction Animate::Reverse() const
|
||||
spAction Animation::Reverse() const
|
||||
{
|
||||
if (animation_)
|
||||
if (frames_)
|
||||
{
|
||||
auto animation = animation_->Reverse();
|
||||
auto animation = frames_->Reverse();
|
||||
if (animation)
|
||||
{
|
||||
return new (std::nothrow) Animate(animation);
|
||||
return new (std::nothrow) Animation(animation);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Animation
|
||||
//-------------------------------------------------------
|
||||
|
||||
Animation::Animation()
|
||||
: interval_(1)
|
||||
{
|
||||
}
|
||||
|
||||
Animation::Animation(const Images& frames)
|
||||
: interval_(1)
|
||||
{
|
||||
this->Add(frames);
|
||||
}
|
||||
|
||||
Animation::Animation(Duration const& interval)
|
||||
: interval_(interval)
|
||||
{
|
||||
}
|
||||
|
||||
Animation::Animation(Duration const& interval, const Images& frames)
|
||||
: interval_(interval)
|
||||
{
|
||||
this->Add(frames);
|
||||
}
|
||||
|
||||
Animation::~Animation()
|
||||
{
|
||||
}
|
||||
|
||||
void Animation::SetInterval(Duration const& interval)
|
||||
{
|
||||
interval_ = interval;
|
||||
}
|
||||
|
||||
void Animation::Add(spImage const& frame)
|
||||
{
|
||||
if (!frame)
|
||||
logs::Warningln("Animation::Add failed, frame is nullptr.");
|
||||
|
||||
if (frame)
|
||||
{
|
||||
frames_.push_back(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::Add(const Images& frames)
|
||||
{
|
||||
for (const auto &image : frames)
|
||||
{
|
||||
this->Add(image);
|
||||
}
|
||||
}
|
||||
|
||||
Duration const& Animation::GetInterval() const
|
||||
{
|
||||
return interval_;
|
||||
}
|
||||
|
||||
Animation::Images const& Animation::GetFrames() const
|
||||
{
|
||||
return frames_;
|
||||
}
|
||||
|
||||
spAnimation Animation::Clone() const
|
||||
{
|
||||
auto animation = new (std::nothrow) Animation(interval_);
|
||||
if (animation)
|
||||
{
|
||||
for (const auto& frame : frames_)
|
||||
{
|
||||
animation->Add(frame);
|
||||
}
|
||||
}
|
||||
return animation;
|
||||
}
|
||||
|
||||
spAnimation Animation::Reverse() const
|
||||
{
|
||||
auto animation = new (std::nothrow) Animation(interval_);
|
||||
if (!frames_.empty())
|
||||
{
|
||||
for (auto iter = frames_.crbegin(), crend = frames_.crend(); iter != crend; ++iter)
|
||||
{
|
||||
if (*iter)
|
||||
animation->Add(*iter);
|
||||
}
|
||||
}
|
||||
return animation;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,80 +25,23 @@ namespace easy2d
|
|||
{
|
||||
// 帧动画
|
||||
class Animation
|
||||
: public ObjectBase
|
||||
: public Action
|
||||
{
|
||||
using Images = std::vector< spImage >;
|
||||
|
||||
public:
|
||||
Animation();
|
||||
|
||||
explicit Animation(
|
||||
const Images& frames /* 关键帧数组 */
|
||||
);
|
||||
|
||||
explicit Animation(
|
||||
Duration const& interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
explicit Animation(
|
||||
Duration const& interval, /* 帧间隔(秒) */
|
||||
const Images& frames /* 关键帧数组 */
|
||||
spFrames const& animation
|
||||
);
|
||||
|
||||
virtual ~Animation();
|
||||
|
||||
// 添加关键帧
|
||||
void Add(
|
||||
spImage const& frame /* 关键帧 */
|
||||
);
|
||||
|
||||
// 添加多个关键帧
|
||||
void Add(
|
||||
const Images& frames /* 关键帧数组 */
|
||||
);
|
||||
|
||||
// 获取帧间隔
|
||||
Duration const& GetInterval() const;
|
||||
|
||||
// 获取关键帧
|
||||
Images const& GetFrames() const;
|
||||
|
||||
// 设置每一帧的时间间隔
|
||||
void SetInterval(
|
||||
Duration const& interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
// 获取帧动画的拷贝对象
|
||||
spAnimation Clone() const;
|
||||
|
||||
// 获取帧动画的倒转
|
||||
spAnimation Reverse() const;
|
||||
|
||||
protected:
|
||||
Duration interval_;
|
||||
Images frames_;
|
||||
};
|
||||
|
||||
|
||||
// 精灵动作
|
||||
class Animate
|
||||
: public Action
|
||||
{
|
||||
public:
|
||||
Animate();
|
||||
|
||||
explicit Animate(
|
||||
spAnimation const& animation
|
||||
);
|
||||
|
||||
virtual ~Animate();
|
||||
|
||||
// 获取动画
|
||||
spAnimation GetAnimation() const;
|
||||
spFrames GetAnimation() const;
|
||||
|
||||
// 设置动画
|
||||
void SetAnimation(
|
||||
spAnimation const& animation
|
||||
spFrames const& animation
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -120,6 +63,6 @@ namespace easy2d
|
|||
protected:
|
||||
size_t frame_index_;
|
||||
Duration delta_;
|
||||
spAnimation animation_;
|
||||
spFrames frames_;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,32 +18,47 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "CallFunc.h"
|
||||
#include "Delay.h"
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
CallFunc::CallFunc(const Callback& func) :
|
||||
callback_(func)
|
||||
Delay::Delay(Duration const& duration)
|
||||
: delta_()
|
||||
, delay_(duration)
|
||||
{
|
||||
}
|
||||
|
||||
spAction CallFunc::Clone() const
|
||||
void Delay::Reset()
|
||||
{
|
||||
return new CallFunc(callback_);
|
||||
Action::Reset();
|
||||
delta_ = Duration{};
|
||||
}
|
||||
|
||||
spAction CallFunc::Reverse() const
|
||||
void Delay::Init(Node* target)
|
||||
{
|
||||
return new CallFunc(callback_);
|
||||
Action::Init(target);
|
||||
}
|
||||
|
||||
void CallFunc::Init(Node*)
|
||||
void Delay::Update(Node* target, Duration const& dt)
|
||||
{
|
||||
}
|
||||
Action::Update(target, dt);
|
||||
|
||||
void CallFunc::Update(Node*, Duration const&)
|
||||
delta_ += dt;
|
||||
|
||||
if (delta_ >= delay_)
|
||||
{
|
||||
callback_();
|
||||
this->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
spAction Delay::Clone() const
|
||||
{
|
||||
return new (std::nothrow) Delay(delay_);
|
||||
}
|
||||
|
||||
spAction Delay::Reverse() const
|
||||
{
|
||||
return new (std::nothrow) Delay(delay_);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,19 +20,16 @@
|
|||
|
||||
#pragma once
|
||||
#include "Action.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
// 回调动作
|
||||
class CallFunc
|
||||
// 延时
|
||||
class Delay
|
||||
: public Action
|
||||
{
|
||||
typedef std::function<void()> Callback;
|
||||
|
||||
public:
|
||||
explicit CallFunc(
|
||||
const Callback &func /* 函数对象 */
|
||||
explicit Delay(
|
||||
Duration const& duration /* 延迟时长(秒) */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -41,14 +38,16 @@ namespace easy2d
|
|||
// 获取该动作的倒转
|
||||
virtual spAction Reverse() const override;
|
||||
|
||||
protected:
|
||||
// 初始化动作
|
||||
virtual void Init(Node*) override;
|
||||
|
||||
// 更新动作
|
||||
virtual void Update(Node*, Duration const&) override;
|
||||
// 重置动作
|
||||
virtual void Reset() override;
|
||||
|
||||
protected:
|
||||
Callback callback_;
|
||||
virtual void Init(Node* target) override;
|
||||
|
||||
virtual void Update(Node* target, Duration const& dt) override;
|
||||
|
||||
protected:
|
||||
Duration delay_;
|
||||
Duration delta_;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "Frames.h"
|
||||
#include "Image.h"
|
||||
#include "logs.h"
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
Frames::Frames()
|
||||
: interval_(1)
|
||||
{
|
||||
}
|
||||
|
||||
Frames::Frames(Images const& frames)
|
||||
: interval_(1)
|
||||
{
|
||||
this->Add(frames);
|
||||
}
|
||||
|
||||
Frames::Frames(Duration const& interval)
|
||||
: interval_(interval)
|
||||
{
|
||||
}
|
||||
|
||||
Frames::Frames(Duration const& interval, Images const& frames)
|
||||
: interval_(interval)
|
||||
{
|
||||
this->Add(frames);
|
||||
}
|
||||
|
||||
Frames::~Frames()
|
||||
{
|
||||
}
|
||||
|
||||
void Frames::SetInterval(Duration const& interval)
|
||||
{
|
||||
interval_ = interval;
|
||||
}
|
||||
|
||||
void Frames::Add(spImage const& frame)
|
||||
{
|
||||
if (!frame)
|
||||
logs::Warningln("Frames::Add failed, frame is nullptr.");
|
||||
|
||||
if (frame)
|
||||
{
|
||||
frames_.push_back(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void Frames::Add(Images const& frames)
|
||||
{
|
||||
for (const auto &image : frames)
|
||||
{
|
||||
this->Add(image);
|
||||
}
|
||||
}
|
||||
|
||||
Duration const& Frames::GetInterval() const
|
||||
{
|
||||
return interval_;
|
||||
}
|
||||
|
||||
Frames::Images const& Frames::GetFrames() const
|
||||
{
|
||||
return frames_;
|
||||
}
|
||||
|
||||
spFrames Frames::Clone() const
|
||||
{
|
||||
auto animation = new (std::nothrow) Frames(interval_);
|
||||
if (animation)
|
||||
{
|
||||
for (const auto& frame : frames_)
|
||||
{
|
||||
animation->Add(frame);
|
||||
}
|
||||
}
|
||||
return animation;
|
||||
}
|
||||
|
||||
spFrames Frames::Reverse() const
|
||||
{
|
||||
auto animation = new (std::nothrow) Frames(interval_);
|
||||
if (!frames_.empty())
|
||||
{
|
||||
for (auto iter = frames_.crbegin(), crend = frames_.crend(); iter != crend; ++iter)
|
||||
{
|
||||
if (*iter)
|
||||
animation->Add(*iter);
|
||||
}
|
||||
}
|
||||
return animation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include "base.hpp"
|
||||
#include "time.h"
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
// 帧集合
|
||||
class Frames
|
||||
: public ObjectBase
|
||||
{
|
||||
using Images = std::vector< spImage >;
|
||||
|
||||
public:
|
||||
Frames();
|
||||
|
||||
explicit Frames(
|
||||
Images const& frames /* 关键帧数组 */
|
||||
);
|
||||
|
||||
explicit Frames(
|
||||
Duration const& interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
explicit Frames(
|
||||
Duration const& interval, /* 帧间隔(秒) */
|
||||
Images const& frames /* 关键帧数组 */
|
||||
);
|
||||
|
||||
virtual ~Frames();
|
||||
|
||||
// 添加关键帧
|
||||
void Add(
|
||||
spImage const& frame /* 关键帧 */
|
||||
);
|
||||
|
||||
// 添加多个关键帧
|
||||
void Add(
|
||||
Images const& frames /* 关键帧数组 */
|
||||
);
|
||||
|
||||
// 获取帧间隔
|
||||
Duration const& GetInterval() const;
|
||||
|
||||
// 获取关键帧
|
||||
Images const& GetFrames() const;
|
||||
|
||||
// 设置每一帧的时间间隔
|
||||
void SetInterval(
|
||||
Duration const& interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
// 获取帧动画的拷贝对象
|
||||
spFrames Clone() const;
|
||||
|
||||
// 获取帧动画的倒转
|
||||
spFrames Reverse() const;
|
||||
|
||||
protected:
|
||||
Duration interval_;
|
||||
Images frames_;
|
||||
};
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ namespace easy2d
|
|||
E2D_DECLARE_SMART_PTR(Image);
|
||||
E2D_DECLARE_SMART_PTR(Music);
|
||||
E2D_DECLARE_SMART_PTR(Task);
|
||||
E2D_DECLARE_SMART_PTR(Frames);
|
||||
|
||||
E2D_DECLARE_SMART_PTR(Geometry);
|
||||
E2D_DECLARE_SMART_PTR(LineGeometry);
|
||||
|
|
@ -60,6 +61,7 @@ namespace easy2d
|
|||
E2D_DECLARE_SMART_PTR(GeometryNode);
|
||||
|
||||
E2D_DECLARE_SMART_PTR(Action);
|
||||
E2D_DECLARE_SMART_PTR(Tween);
|
||||
E2D_DECLARE_SMART_PTR(MoveBy);
|
||||
E2D_DECLARE_SMART_PTR(MoveTo);
|
||||
E2D_DECLARE_SMART_PTR(JumpBy);
|
||||
|
|
@ -75,8 +77,6 @@ namespace easy2d
|
|||
E2D_DECLARE_SMART_PTR(PathAction);
|
||||
E2D_DECLARE_SMART_PTR(Delay);
|
||||
E2D_DECLARE_SMART_PTR(Animation);
|
||||
E2D_DECLARE_SMART_PTR(Animate);
|
||||
E2D_DECLARE_SMART_PTR(CallFunc);
|
||||
E2D_DECLARE_SMART_PTR(Loop);
|
||||
E2D_DECLARE_SMART_PTR(Sequence);
|
||||
E2D_DECLARE_SMART_PTR(Spawn);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
#include "base/Task.h"
|
||||
#include "base/Action.hpp"
|
||||
#include "base/ActionCombined.h"
|
||||
#include "base/ActionInterval.h"
|
||||
#include "base/ActionTween.h"
|
||||
#include "base/Animation.h"
|
||||
#include "base/CallFunc.h"
|
||||
#include "base/Transition.h"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include "scalar.hpp"
|
||||
|
||||
namespace easy2d
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
inline float Linear(float step)
|
||||
{
|
||||
return step;
|
||||
}
|
||||
|
||||
inline float EaseIn(float step, float rate)
|
||||
{
|
||||
return math::Pow(step, rate);
|
||||
}
|
||||
|
||||
inline float EaseOut(float step, float rate)
|
||||
{
|
||||
return math::Pow(step, 1.f / rate);
|
||||
}
|
||||
|
||||
inline float EaseInOut(float step, float rate)
|
||||
{
|
||||
if (step < .5f)
|
||||
return .5f * math::Pow(2 * step, rate);
|
||||
return 1.f - .5f * math::Pow(2.f - 2 * step, rate);
|
||||
}
|
||||
|
||||
inline float EaseExponentialIn(float step)
|
||||
{
|
||||
return math::Pow(2.f, 10 * (step - 1));
|
||||
}
|
||||
|
||||
inline float EaseExponentialOut(float step)
|
||||
{
|
||||
return 1.f - math::Pow(2.f, -10 * step);
|
||||
}
|
||||
|
||||
inline float EaseExponentialInOut(float step)
|
||||
{
|
||||
if (step < .5f)
|
||||
return .5f * math::Pow(2.f, 10 * (2 * step - 1));
|
||||
return 0.5f * (2 - math::Pow(2, -10 * (step * 2 - 1)));
|
||||
}
|
||||
|
||||
inline float EaseSineIn(float step)
|
||||
{
|
||||
return 1.f - math::Cos(step * 90);
|
||||
}
|
||||
|
||||
inline float EaseSineOut(float step)
|
||||
{
|
||||
return math::Sin(step * 90);
|
||||
}
|
||||
|
||||
inline float EaseSineInOut(float step)
|
||||
{
|
||||
return -0.5f * (math::Cos(step * 180) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,8 +34,10 @@ namespace easy2d
|
|||
{
|
||||
namespace constants
|
||||
{
|
||||
E2D_CONSTEXPR auto PIf = 3.14159265358979f;
|
||||
E2D_CONSTEXPR auto PId = 3.14159265358979323846;
|
||||
E2D_CONSTEXPR auto PI_F = 3.141592653589793f;
|
||||
E2D_CONSTEXPR auto PI_F_2 = 1.570796326794896f;
|
||||
E2D_CONSTEXPR auto PI_D = 3.14159265358979323846;
|
||||
E2D_CONSTEXPR auto PI_D_2 = 1.57079632679489661923;
|
||||
}
|
||||
|
||||
inline int Abs(int val) { return ::abs(val); }
|
||||
|
|
@ -48,35 +50,39 @@ namespace easy2d
|
|||
|
||||
inline double Sqrt(double val) { return ::sqrt(val); }
|
||||
|
||||
inline float Pow(float base, float exponent) { return ::powf(base, exponent); }
|
||||
|
||||
inline double Pow(double base, double exponent) { return ::pow(base, exponent); }
|
||||
|
||||
inline int Sign(int val) { return val < 0 ? -1 : 1; }
|
||||
|
||||
inline float Sign(float val) { return val < 0 ? -1.f : 1.f; }
|
||||
|
||||
inline double Sign(double val) { return val < 0 ? -1.0 : 1.0; }
|
||||
|
||||
inline float Sin(float val) { return ::sinf(val * constants::PIf / 180.f); }
|
||||
inline float Sin(float val) { return ::sinf(val * constants::PI_F / 180.f); }
|
||||
|
||||
inline double Sin(double val) { return ::sin(val * constants::PId / 180.0); }
|
||||
inline double Sin(double val) { return ::sin(val * constants::PI_D / 180.0); }
|
||||
|
||||
inline float Cos(float val) { return ::cosf(val * constants::PIf / 180.f); }
|
||||
inline float Cos(float val) { return ::cosf(val * constants::PI_F / 180.f); }
|
||||
|
||||
inline double Cos(double val) { return ::cos(val * constants::PId / 180.0); }
|
||||
inline double Cos(double val) { return ::cos(val * constants::PI_D / 180.0); }
|
||||
|
||||
inline float Tan(float val) { return ::tanf(val * constants::PIf / 180.f); }
|
||||
inline float Tan(float val) { return ::tanf(val * constants::PI_F / 180.f); }
|
||||
|
||||
inline double Tan(double val) { return ::tan(val * constants::PId / 180.0); }
|
||||
inline double Tan(double val) { return ::tan(val * constants::PI_D / 180.0); }
|
||||
|
||||
inline float Asin(float val) { return ::asinf(val) * 180.f / constants::PIf; }
|
||||
inline float Asin(float val) { return ::asinf(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline double Asin(double val) { return ::asin(val) * 180.f / constants::PIf; }
|
||||
inline double Asin(double val) { return ::asin(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline float Acos(float val) { return ::acosf(val) * 180.f / constants::PIf; }
|
||||
inline float Acos(float val) { return ::acosf(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline double Acos(double val) { return ::acos(val) * 180.f / constants::PIf; }
|
||||
inline double Acos(double val) { return ::acos(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline float Atan(float val) { return ::atanf(val) * 180.f / constants::PIf; }
|
||||
inline float Atan(float val) { return ::atanf(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline double Atan(double val) { return ::atan(val) * 180.f / constants::PIf; }
|
||||
inline double Atan(double val) { return ::atan(val) * 180.f / constants::PI_F; }
|
||||
|
||||
inline float Ceil(float val) { return ::ceil(val); }
|
||||
|
||||
|
|
|
|||
|
|
@ -21,18 +21,19 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\base\Action.hpp" />
|
||||
<ClInclude Include="..\..\core\base\ActionCombined.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionManager.h" />
|
||||
<ClInclude Include="..\..\core\base\Animation.h" />
|
||||
<ClInclude Include="..\..\core\base\audio.h" />
|
||||
<ClInclude Include="..\..\core\base\base.hpp" />
|
||||
<ClInclude Include="..\..\core\base\BaseTypes.hpp" />
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h" />
|
||||
<ClInclude Include="..\..\core\base\Canvas.h" />
|
||||
<ClInclude Include="..\..\core\base\Color.h" />
|
||||
<ClInclude Include="..\..\core\base\d2dres.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Debuger.h" />
|
||||
<ClInclude Include="..\..\core\base\Delay.h" />
|
||||
<ClInclude Include="..\..\core\base\Font.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Frames.h" />
|
||||
<ClInclude Include="..\..\core\base\Game.h" />
|
||||
<ClInclude Include="..\..\core\base\Geometry.h" />
|
||||
<ClInclude Include="..\..\core\base\GeometryNode.h" />
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h" />
|
||||
<ClInclude Include="..\..\core\base\window.h" />
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
<ClInclude Include="..\..\core\math\ease.hpp" />
|
||||
<ClInclude Include="..\..\core\math\Matrix.hpp" />
|
||||
<ClInclude Include="..\..\core\math\rand.h" />
|
||||
<ClInclude Include="..\..\core\math\scalar.hpp" />
|
||||
|
|
@ -84,14 +86,15 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\core\base\ActionCombined.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Animation.cpp" />
|
||||
<ClCompile Include="..\..\core\base\audio.cpp" />
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Color.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Debuger.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Game.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Geometry.cpp" />
|
||||
<ClCompile Include="..\..\core\base\GeometryNode.cpp" />
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@
|
|||
<ClInclude Include="..\..\core\base\audio.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Canvas.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -182,7 +179,16 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h">
|
||||
<ClInclude Include="..\..\core\math\ease.hpp">
|
||||
<Filter>math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Delay.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Frames.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
@ -213,9 +219,6 @@
|
|||
<ClCompile Include="..\..\core\base\audio.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -327,7 +330,13 @@
|
|||
<ClCompile Include="..\..\core\base\Unit.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp">
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -21,18 +21,19 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\base\Action.hpp" />
|
||||
<ClInclude Include="..\..\core\base\ActionCombined.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionManager.h" />
|
||||
<ClInclude Include="..\..\core\base\Animation.h" />
|
||||
<ClInclude Include="..\..\core\base\audio.h" />
|
||||
<ClInclude Include="..\..\core\base\base.hpp" />
|
||||
<ClInclude Include="..\..\core\base\BaseTypes.hpp" />
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h" />
|
||||
<ClInclude Include="..\..\core\base\Canvas.h" />
|
||||
<ClInclude Include="..\..\core\base\Color.h" />
|
||||
<ClInclude Include="..\..\core\base\d2dres.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Debuger.h" />
|
||||
<ClInclude Include="..\..\core\base\Delay.h" />
|
||||
<ClInclude Include="..\..\core\base\Font.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Frames.h" />
|
||||
<ClInclude Include="..\..\core\base\Game.h" />
|
||||
<ClInclude Include="..\..\core\base\Geometry.h" />
|
||||
<ClInclude Include="..\..\core\base\GeometryNode.h" />
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h" />
|
||||
<ClInclude Include="..\..\core\base\window.h" />
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
<ClInclude Include="..\..\core\math\ease.hpp" />
|
||||
<ClInclude Include="..\..\core\math\Matrix.hpp" />
|
||||
<ClInclude Include="..\..\core\math\rand.h" />
|
||||
<ClInclude Include="..\..\core\math\scalar.hpp" />
|
||||
|
|
@ -84,14 +86,15 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\core\base\ActionCombined.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Animation.cpp" />
|
||||
<ClCompile Include="..\..\core\base\audio.cpp" />
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Color.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Debuger.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Game.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Geometry.cpp" />
|
||||
<ClCompile Include="..\..\core\base\GeometryNode.cpp" />
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@
|
|||
<ClInclude Include="..\..\core\base\audio.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Canvas.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -182,7 +179,16 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h">
|
||||
<ClInclude Include="..\..\core\math\ease.hpp">
|
||||
<Filter>math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Delay.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Frames.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
@ -213,9 +219,6 @@
|
|||
<ClCompile Include="..\..\core\base\audio.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -327,7 +330,13 @@
|
|||
<ClCompile Include="..\..\core\base\Unit.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp">
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -21,18 +21,19 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\base\Action.hpp" />
|
||||
<ClInclude Include="..\..\core\base\ActionCombined.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h" />
|
||||
<ClInclude Include="..\..\core\base\ActionManager.h" />
|
||||
<ClInclude Include="..\..\core\base\Animation.h" />
|
||||
<ClInclude Include="..\..\core\base\audio.h" />
|
||||
<ClInclude Include="..\..\core\base\base.hpp" />
|
||||
<ClInclude Include="..\..\core\base\BaseTypes.hpp" />
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h" />
|
||||
<ClInclude Include="..\..\core\base\Canvas.h" />
|
||||
<ClInclude Include="..\..\core\base\Color.h" />
|
||||
<ClInclude Include="..\..\core\base\d2dres.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Debuger.h" />
|
||||
<ClInclude Include="..\..\core\base\Delay.h" />
|
||||
<ClInclude Include="..\..\core\base\Font.hpp" />
|
||||
<ClInclude Include="..\..\core\base\Frames.h" />
|
||||
<ClInclude Include="..\..\core\base\Game.h" />
|
||||
<ClInclude Include="..\..\core\base\Geometry.h" />
|
||||
<ClInclude Include="..\..\core\base\GeometryNode.h" />
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h" />
|
||||
<ClInclude Include="..\..\core\base\window.h" />
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
<ClInclude Include="..\..\core\math\ease.hpp" />
|
||||
<ClInclude Include="..\..\core\math\Matrix.hpp" />
|
||||
<ClInclude Include="..\..\core\math\rand.h" />
|
||||
<ClInclude Include="..\..\core\math\scalar.hpp" />
|
||||
|
|
@ -84,14 +86,15 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\core\base\ActionCombined.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp" />
|
||||
<ClCompile Include="..\..\core\base\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Animation.cpp" />
|
||||
<ClCompile Include="..\..\core\base\audio.cpp" />
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Color.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Debuger.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Game.cpp" />
|
||||
<ClCompile Include="..\..\core\base\Geometry.cpp" />
|
||||
<ClCompile Include="..\..\core\base\GeometryNode.cpp" />
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@
|
|||
<ClInclude Include="..\..\core\base\audio.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\CallFunc.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Canvas.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -182,7 +179,16 @@
|
|||
<ClInclude Include="..\..\core\base\Unit.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionInterval.h">
|
||||
<ClInclude Include="..\..\core\math\ease.hpp">
|
||||
<Filter>math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\ActionTween.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Delay.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\core\base\Frames.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
@ -213,9 +219,6 @@
|
|||
<ClCompile Include="..\..\core\base\audio.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\CallFunc.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Canvas.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -327,7 +330,13 @@
|
|||
<ClCompile Include="..\..\core\base\Unit.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\ActionInterval.cpp">
|
||||
<ClCompile Include="..\..\core\base\ActionTween.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Delay.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\base\Frames.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in New Issue