ResLoader supports cropping of image assets now
minor minor minor fixes
This commit is contained in:
parent
d223cd60ae
commit
63afe9bf39
|
|
@ -52,12 +52,16 @@ namespace easy2d
|
||||||
|
|
||||||
TweenActionHelper& SetEaseFunc(EaseFunc ease) { this->ease = ease; return (*this); }
|
TweenActionHelper& SetEaseFunc(EaseFunc ease) { this->ease = ease; return (*this); }
|
||||||
|
|
||||||
TweenActionHelper(ActionTweenPtr const& base) : base(base), dur(), loop(0), ease(EaseFunc::Linear) {}
|
TweenActionHelper(ActionTweenPtr const& base) : base(base), dur(), loop(0), ease(nullptr)
|
||||||
|
{
|
||||||
|
dur = base->GetDuration();
|
||||||
|
}
|
||||||
|
|
||||||
operator ActionPtr() const
|
operator ActionPtr() const
|
||||||
{
|
{
|
||||||
base->SetEaseFunction(ease);
|
base->SetEaseFunc(ease);
|
||||||
base->SetDuration(dur);
|
base->SetDuration(dur);
|
||||||
|
|
||||||
if (loop)
|
if (loop)
|
||||||
return ActionPtr(new (std::nothrow) Loop(base));
|
return ActionPtr(new (std::nothrow) Loop(base));
|
||||||
return base;
|
return base;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,42 @@
|
||||||
|
|
||||||
namespace easy2d
|
namespace easy2d
|
||||||
{
|
{
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Ease Functions
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
EaseFunc Ease::Linear = math::Linear;
|
||||||
|
EaseFunc Ease::EaseIn = MakeEaseIn(2.f);
|
||||||
|
EaseFunc Ease::EaseOut = MakeEaseOut(2.f);
|
||||||
|
EaseFunc Ease::EaseInOut = MakeEaseInOut(2.f);
|
||||||
|
EaseFunc Ease::ExpoIn = math::EaseExponentialIn;
|
||||||
|
EaseFunc Ease::ExpoOut = math::EaseExponentialOut;
|
||||||
|
EaseFunc Ease::ExpoInOut = math::EaseExponentialInOut;
|
||||||
|
EaseFunc Ease::BounceIn = math::EaseBounceIn;
|
||||||
|
EaseFunc Ease::BounceOut = math::EaseBounceOut;
|
||||||
|
EaseFunc Ease::BounceInOut = math::EaseBounceInOut;
|
||||||
|
EaseFunc Ease::ElasticIn = MakeEaseElasticIn(0.3f);
|
||||||
|
EaseFunc Ease::ElasticOut = MakeEaseElasticOut(0.3f);
|
||||||
|
EaseFunc Ease::ElasticInOut = MakeEaseElasticInOut(0.3f);
|
||||||
|
EaseFunc Ease::SineIn = math::EaseSineIn;
|
||||||
|
EaseFunc Ease::SineOut = math::EaseSineOut;
|
||||||
|
EaseFunc Ease::SineInOut = math::EaseSineInOut;
|
||||||
|
EaseFunc Ease::BackIn = math::EaseBackIn;
|
||||||
|
EaseFunc Ease::BackOut = math::EaseBackOut;
|
||||||
|
EaseFunc Ease::BackInOut = math::EaseBackInOut;
|
||||||
|
EaseFunc Ease::QuadIn = math::EaseQuadIn;
|
||||||
|
EaseFunc Ease::QuadOut = math::EaseQuadOut;
|
||||||
|
EaseFunc Ease::QuadInOut = math::EaseQuadInOut;
|
||||||
|
EaseFunc Ease::CubicIn = math::EaseCubicIn;
|
||||||
|
EaseFunc Ease::CubicOut = math::EaseCubicOut;
|
||||||
|
EaseFunc Ease::CubicInOut = math::EaseCubicInOut;
|
||||||
|
EaseFunc Ease::QuartIn = math::EaseQuartIn;
|
||||||
|
EaseFunc Ease::QuartOut = math::EaseQuartOut;
|
||||||
|
EaseFunc Ease::QuartInOut = math::EaseQuartInOut;
|
||||||
|
EaseFunc Ease::QuintIn = math::EaseQuintIn;
|
||||||
|
EaseFunc Ease::QuintOut = math::EaseQuintOut;
|
||||||
|
EaseFunc Ease::QuintInOut = math::EaseQuintInOut;
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// ActionTween
|
// ActionTween
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
@ -33,127 +69,25 @@ namespace easy2d
|
||||||
ActionTween::ActionTween()
|
ActionTween::ActionTween()
|
||||||
: elapsed_()
|
: elapsed_()
|
||||||
, duration_()
|
, duration_()
|
||||||
, ease_func_(math::Linear)
|
, ease_func_(nullptr)
|
||||||
, ease_type_(EaseFunc::Linear)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionTween::ActionTween(Duration duration, EaseFunc func)
|
ActionTween::ActionTween(Duration duration, EaseFunc func)
|
||||||
: elapsed_()
|
: elapsed_()
|
||||||
, ease_func_(math::Linear)
|
|
||||||
, ease_type_(EaseFunc::Linear)
|
|
||||||
{
|
{
|
||||||
SetDuration(duration);
|
SetDuration(duration);
|
||||||
SetEaseFunction(func);
|
SetEaseFunc(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTween::SetEaseFunction(EaseFunc func)
|
void ActionTween::SetEaseFunc(EaseFunc const& func)
|
||||||
{
|
|
||||||
ease_type_ = func;
|
|
||||||
switch (func)
|
|
||||||
{
|
|
||||||
case EaseFunc::Linear:
|
|
||||||
ease_func_ = math::Linear;
|
|
||||||
break;
|
|
||||||
case EaseFunc::EaseIn:
|
|
||||||
ease_func_ = MakeEaseIn(2.f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::EaseOut:
|
|
||||||
ease_func_ = MakeEaseOut(2.f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::EaseInOut:
|
|
||||||
ease_func_ = MakeEaseInOut(2.f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::ExpoIn:
|
|
||||||
ease_func_ = math::EaseExponentialIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::ExpoOut:
|
|
||||||
ease_func_ = math::EaseExponentialOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::ExpoInOut:
|
|
||||||
ease_func_ = math::EaseExponentialInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BounceIn:
|
|
||||||
ease_func_ = math::EaseBounceIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BounceOut:
|
|
||||||
ease_func_ = math::EaseBounceOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BounceInOut:
|
|
||||||
ease_func_ = math::EaseBounceInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::ElasticIn:
|
|
||||||
ease_func_ = MakeEaseElasticIn(0.3f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::ElasticOut:
|
|
||||||
ease_func_ = MakeEaseElasticOut(0.3f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::ElasticInOut:
|
|
||||||
ease_func_ = MakeEaseElasticInOut(0.3f);
|
|
||||||
break;
|
|
||||||
case EaseFunc::SineIn:
|
|
||||||
ease_func_ = math::EaseSineIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::SineOut:
|
|
||||||
ease_func_ = math::EaseSineOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::SineInOut:
|
|
||||||
ease_func_ = math::EaseSineInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BackIn:
|
|
||||||
ease_func_ = math::EaseBackIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BackOut:
|
|
||||||
ease_func_ = math::EaseBackOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::BackInOut:
|
|
||||||
ease_func_ = math::EaseBackInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuadIn:
|
|
||||||
ease_func_ = math::EaseQuadIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuadOut:
|
|
||||||
ease_func_ = math::EaseQuadOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuadInOut:
|
|
||||||
ease_func_ = math::EaseQuadInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::CubicIn:
|
|
||||||
ease_func_ = math::EaseCubicIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::CubicOut:
|
|
||||||
ease_func_ = math::EaseCubicOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::CubicInOut:
|
|
||||||
ease_func_ = math::EaseCubicInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuartIn:
|
|
||||||
ease_func_ = math::EaseQuartIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuartOut:
|
|
||||||
ease_func_ = math::EaseQuartOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuartInOut:
|
|
||||||
ease_func_ = math::EaseQuartInOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuintIn:
|
|
||||||
ease_func_ = math::EaseQuintIn;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuintOut:
|
|
||||||
ease_func_ = math::EaseQuintOut;
|
|
||||||
break;
|
|
||||||
case EaseFunc::QuintInOut:
|
|
||||||
ease_func_ = math::EaseQuintInOut;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionTween::SetEaseFunction(EaseFunction func)
|
|
||||||
{
|
{
|
||||||
ease_func_ = func;
|
ease_func_ = func;
|
||||||
ease_type_ = EaseFunc(-1);
|
}
|
||||||
|
|
||||||
|
EaseFunc const & ActionTween::GetEaseFunc() const
|
||||||
|
{
|
||||||
|
return ease_func_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTween::Reset()
|
void ActionTween::Reset()
|
||||||
|
|
@ -177,22 +111,28 @@ namespace easy2d
|
||||||
Action::Update(target, dt);
|
Action::Update(target, dt);
|
||||||
|
|
||||||
float step;
|
float step;
|
||||||
|
|
||||||
if (duration_.IsZero())
|
if (duration_.IsZero())
|
||||||
{
|
{
|
||||||
step = 1.f;
|
step = 1.f;
|
||||||
|
this->Stop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
elapsed_ += dt;
|
elapsed_ += dt;
|
||||||
step = std::min(elapsed_ / duration_, 1.f);
|
step = elapsed_ / duration_;
|
||||||
}
|
|
||||||
|
|
||||||
if ((1.f - step) <= FLT_EPSILON)
|
if (1.f <= step)
|
||||||
{
|
{
|
||||||
|
step = 1.f;
|
||||||
this->Stop();
|
this->Stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateStep(target, ease_func_(step));
|
if (ease_func_)
|
||||||
|
step = ease_func_(step);
|
||||||
|
|
||||||
|
UpdateStep(target, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTween::SetDuration(Duration duration)
|
void ActionTween::SetDuration(Duration duration)
|
||||||
|
|
@ -234,12 +174,12 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr MoveBy::Clone() const
|
ActionPtr MoveBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) MoveBy(duration_, delta_pos_, ease_type_);
|
return new (std::nothrow) MoveBy(duration_, delta_pos_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr MoveBy::Reverse() const
|
ActionPtr MoveBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) MoveBy(duration_, -delta_pos_, ease_type_);
|
return new (std::nothrow) MoveBy(duration_, -delta_pos_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveTo::MoveTo(Duration duration, Point const& pos, EaseFunc func)
|
MoveTo::MoveTo(Duration duration, Point const& pos, EaseFunc func)
|
||||||
|
|
@ -250,7 +190,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr MoveTo::Clone() const
|
ActionPtr MoveTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) MoveTo(duration_, end_pos_, ease_type_);
|
return new (std::nothrow) MoveTo(duration_, end_pos_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveTo::Init(Node* target)
|
void MoveTo::Init(Node* target)
|
||||||
|
|
@ -274,12 +214,12 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr JumpBy::Clone() const
|
ActionPtr JumpBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) JumpBy(duration_, delta_pos_, height_, jumps_, ease_type_);
|
return new (std::nothrow) JumpBy(duration_, delta_pos_, height_, jumps_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr JumpBy::Reverse() const
|
ActionPtr JumpBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) JumpBy(duration_, -delta_pos_, height_, jumps_, ease_type_);
|
return new (std::nothrow) JumpBy(duration_, -delta_pos_, height_, jumps_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpBy::Init(Node* target)
|
void JumpBy::Init(Node* target)
|
||||||
|
|
@ -316,7 +256,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr JumpTo::Clone() const
|
ActionPtr JumpTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) JumpTo(duration_, end_pos_, height_, jumps_, ease_type_);
|
return new (std::nothrow) JumpTo(duration_, end_pos_, height_, jumps_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpTo::Init(Node* target)
|
void JumpTo::Init(Node* target)
|
||||||
|
|
@ -362,12 +302,12 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr ScaleBy::Clone() const
|
ActionPtr ScaleBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) ScaleBy(duration_, delta_x_, delta_y_, ease_type_);
|
return new (std::nothrow) ScaleBy(duration_, delta_x_, delta_y_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr ScaleBy::Reverse() const
|
ActionPtr ScaleBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) ScaleBy(duration_, -delta_x_, -delta_y_, ease_type_);
|
return new (std::nothrow) ScaleBy(duration_, -delta_x_, -delta_y_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaleTo::ScaleTo(Duration duration, float scale, EaseFunc func)
|
ScaleTo::ScaleTo(Duration duration, float scale, EaseFunc func)
|
||||||
|
|
@ -386,7 +326,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr ScaleTo::Clone() const
|
ActionPtr ScaleTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) ScaleTo(duration_, end_scale_x_, end_scale_y_, ease_type_);
|
return new (std::nothrow) ScaleTo(duration_, end_scale_x_, end_scale_y_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleTo::Init(Node* target)
|
void ScaleTo::Init(Node* target)
|
||||||
|
|
@ -424,12 +364,12 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr OpacityBy::Clone() const
|
ActionPtr OpacityBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) OpacityBy(duration_, delta_val_, ease_type_);
|
return new (std::nothrow) OpacityBy(duration_, delta_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr OpacityBy::Reverse() const
|
ActionPtr OpacityBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) OpacityBy(duration_, -delta_val_, ease_type_);
|
return new (std::nothrow) OpacityBy(duration_, -delta_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
OpacityTo::OpacityTo(Duration duration, float opacity, EaseFunc func)
|
OpacityTo::OpacityTo(Duration duration, float opacity, EaseFunc func)
|
||||||
|
|
@ -440,7 +380,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr OpacityTo::Clone() const
|
ActionPtr OpacityTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) OpacityTo(duration_, end_val_, ease_type_);
|
return new (std::nothrow) OpacityTo(duration_, end_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpacityTo::Init(Node* target)
|
void OpacityTo::Init(Node* target)
|
||||||
|
|
@ -482,17 +422,21 @@ namespace easy2d
|
||||||
|
|
||||||
void RotateBy::UpdateStep(Node* target, float step)
|
void RotateBy::UpdateStep(Node* target, float step)
|
||||||
{
|
{
|
||||||
target->SetRotation(start_val_ + delta_val_ * step);
|
float rotation = start_val_ + delta_val_ * step;
|
||||||
|
if (rotation > 360.f)
|
||||||
|
rotation -= 360.f;
|
||||||
|
|
||||||
|
target->SetRotation(rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr RotateBy::Clone() const
|
ActionPtr RotateBy::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) RotateBy(duration_, delta_val_, ease_type_);
|
return new (std::nothrow) RotateBy(duration_, delta_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr RotateBy::Reverse() const
|
ActionPtr RotateBy::Reverse() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) RotateBy(duration_, -delta_val_, ease_type_);
|
return new (std::nothrow) RotateBy(duration_, -delta_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
RotateTo::RotateTo(Duration duration, float rotation, EaseFunc func)
|
RotateTo::RotateTo(Duration duration, float rotation, EaseFunc func)
|
||||||
|
|
@ -503,7 +447,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr RotateTo::Clone() const
|
ActionPtr RotateTo::Clone() const
|
||||||
{
|
{
|
||||||
return new (std::nothrow) RotateTo(duration_, end_val_, ease_type_);
|
return new (std::nothrow) RotateTo(duration_, end_val_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotateTo::Init(Node* target)
|
void RotateTo::Init(Node* target)
|
||||||
|
|
@ -528,12 +472,12 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr PathAction::Clone() const
|
ActionPtr PathAction::Clone() const
|
||||||
{
|
{
|
||||||
return new PathAction(duration_, geo_, rotating_, start_, end_, ease_type_);
|
return new PathAction(duration_, geo_, rotating_, start_, end_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr PathAction::Reverse() const
|
ActionPtr PathAction::Reverse() const
|
||||||
{
|
{
|
||||||
return new PathAction(duration_, geo_, rotating_, end_, start_, ease_type_);
|
return new PathAction(duration_, geo_, rotating_, end_, start_, ease_func_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathAction::Init(Node * target)
|
void PathAction::Init(Node * target)
|
||||||
|
|
|
||||||
|
|
@ -25,52 +25,52 @@
|
||||||
|
|
||||||
namespace easy2d
|
namespace easy2d
|
||||||
{
|
{
|
||||||
|
// 缓动函数
|
||||||
|
using EaseFunc = std::function<float(float)>;
|
||||||
|
|
||||||
// 缓动函数枚举
|
// 缓动函数枚举
|
||||||
// See https://easings.net for more information
|
// See https://easings.net for more information
|
||||||
enum class EaseFunc
|
struct Ease
|
||||||
{
|
{
|
||||||
Linear, // 线性
|
static EaseFunc Linear; // 线性
|
||||||
EaseIn, // 由慢变快
|
static EaseFunc EaseIn; // 由慢变快
|
||||||
EaseOut, // 由快变慢
|
static EaseFunc EaseOut; // 由快变慢
|
||||||
EaseInOut, // 由慢变快, 再由快变慢
|
static EaseFunc EaseInOut; // 由慢变快, 再由快变慢
|
||||||
ExpoIn, // 由慢变极快
|
static EaseFunc ExpoIn; // 由慢变极快
|
||||||
ExpoOut, // 由极快变慢
|
static EaseFunc ExpoOut; // 由极快变慢
|
||||||
ExpoInOut, // 由慢至极快, 再由极快边慢
|
static EaseFunc ExpoInOut; // 由慢至极快, 再由极快边慢
|
||||||
ElasticIn, // 自起点赋予弹性
|
static EaseFunc ElasticIn; // 自起点赋予弹性
|
||||||
ElasticOut, // 自终点赋予弹性
|
static EaseFunc ElasticOut; // 自终点赋予弹性
|
||||||
ElasticInOut, // 再起点和终点赋予弹性
|
static EaseFunc ElasticInOut; // 再起点和终点赋予弹性
|
||||||
BounceIn, // 自起点赋予反弹力
|
static EaseFunc BounceIn; // 自起点赋予反弹力
|
||||||
BounceOut, // 自终点赋予反弹力
|
static EaseFunc BounceOut; // 自终点赋予反弹力
|
||||||
BounceInOut, // 在起点和终点赋予反弹力
|
static EaseFunc BounceInOut; // 在起点和终点赋予反弹力
|
||||||
BackIn,
|
static EaseFunc BackIn;
|
||||||
BackOut,
|
static EaseFunc BackOut;
|
||||||
BackInOut,
|
static EaseFunc BackInOut;
|
||||||
QuadIn,
|
static EaseFunc QuadIn;
|
||||||
QuadOut,
|
static EaseFunc QuadOut;
|
||||||
QuadInOut,
|
static EaseFunc QuadInOut;
|
||||||
CubicIn,
|
static EaseFunc CubicIn;
|
||||||
CubicOut,
|
static EaseFunc CubicOut;
|
||||||
CubicInOut,
|
static EaseFunc CubicInOut;
|
||||||
QuartIn,
|
static EaseFunc QuartIn;
|
||||||
QuartOut,
|
static EaseFunc QuartOut;
|
||||||
QuartInOut,
|
static EaseFunc QuartInOut;
|
||||||
QuintIn,
|
static EaseFunc QuintIn;
|
||||||
QuintOut,
|
static EaseFunc QuintOut;
|
||||||
QuintInOut,
|
static EaseFunc QuintInOut;
|
||||||
SineIn,
|
static EaseFunc SineIn;
|
||||||
SineOut,
|
static EaseFunc SineOut;
|
||||||
SineInOut,
|
static EaseFunc SineInOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 缓动函数
|
inline EaseFunc MakeEaseIn(float rate) { return std::bind(math::EaseIn, std::placeholders::_1, rate); }
|
||||||
using EaseFunction = std::function<float(float)>;
|
inline EaseFunc MakeEaseOut(float rate) { return std::bind(math::EaseOut, std::placeholders::_1, rate); }
|
||||||
|
inline EaseFunc MakeEaseInOut(float rate) { return std::bind(math::EaseInOut, std::placeholders::_1, rate); }
|
||||||
inline EaseFunction MakeEaseIn(float rate) { return std::bind(math::EaseIn, std::placeholders::_1, rate); }
|
inline EaseFunc MakeEaseElasticIn(float period) { return std::bind(math::EaseElasticIn, std::placeholders::_1, period); }
|
||||||
inline EaseFunction MakeEaseOut(float rate) { return std::bind(math::EaseOut, std::placeholders::_1, rate); }
|
inline EaseFunc MakeEaseElasticOut(float period) { return std::bind(math::EaseElasticOut, std::placeholders::_1, period); }
|
||||||
inline EaseFunction MakeEaseInOut(float rate) { return std::bind(math::EaseInOut, std::placeholders::_1, rate); }
|
inline EaseFunc MakeEaseElasticInOut(float period) { return std::bind(math::EaseElasticInOut, std::placeholders::_1, period); }
|
||||||
inline EaseFunction MakeEaseElasticIn(float period) { return std::bind(math::EaseElasticIn, std::placeholders::_1, period); }
|
|
||||||
inline EaseFunction MakeEaseElasticOut(float period) { return std::bind(math::EaseElasticOut, std::placeholders::_1, period); }
|
|
||||||
inline EaseFunction MakeEaseElasticInOut(float period) { return std::bind(math::EaseElasticInOut, std::placeholders::_1, period); }
|
|
||||||
|
|
||||||
|
|
||||||
// 补间动画
|
// 补间动画
|
||||||
|
|
@ -80,20 +80,17 @@ namespace easy2d
|
||||||
public:
|
public:
|
||||||
ActionTween();
|
ActionTween();
|
||||||
|
|
||||||
explicit ActionTween(
|
ActionTween(
|
||||||
Duration duration,
|
Duration duration,
|
||||||
EaseFunc func
|
EaseFunc func
|
||||||
);
|
);
|
||||||
|
|
||||||
// 设置缓动函数
|
// 自定义缓动函数
|
||||||
void SetEaseFunction(
|
void SetEaseFunc(
|
||||||
EaseFunc func
|
EaseFunc const& func
|
||||||
);
|
);
|
||||||
|
|
||||||
// 自定义缓动函数
|
EaseFunc const& GetEaseFunc() const;
|
||||||
void SetEaseFunction(
|
|
||||||
EaseFunction func
|
|
||||||
);
|
|
||||||
|
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
|
|
||||||
|
|
@ -111,8 +108,7 @@ namespace easy2d
|
||||||
protected:
|
protected:
|
||||||
Duration duration_;
|
Duration duration_;
|
||||||
Duration elapsed_;
|
Duration elapsed_;
|
||||||
EaseFunc ease_type_;
|
EaseFunc ease_func_;
|
||||||
EaseFunction ease_func_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -121,10 +117,10 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MoveBy(
|
MoveBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
Point const& vector, /* 移动距离 */
|
Point const& vector, /* 移动距离 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -150,10 +146,10 @@ namespace easy2d
|
||||||
: public MoveBy
|
: public MoveBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MoveTo(
|
MoveTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
Point const& pos, /* 目的坐标 */
|
Point const& pos, /* 目的坐标 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -179,12 +175,12 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit JumpBy(
|
JumpBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
Point const& vec, /* 跳跃距离 */
|
Point const& vec, /* 跳跃距离 */
|
||||||
float height, /* 跳跃高度 */
|
float height, /* 跳跃高度 */
|
||||||
int jumps = 1, /* 跳跃次数 */
|
int jumps = 1, /* 跳跃次数 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -212,12 +208,12 @@ namespace easy2d
|
||||||
: public JumpBy
|
: public JumpBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit JumpTo(
|
JumpTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
Point const& pos, /* 目的坐标 */
|
Point const& pos, /* 目的坐标 */
|
||||||
float height, /* 跳跃高度 */
|
float height, /* 跳跃高度 */
|
||||||
int jumps = 1, /* 跳跃次数 */
|
int jumps = 1, /* 跳跃次数 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -243,17 +239,17 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ScaleBy(
|
ScaleBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float scale, /* 相对变化值 */
|
float scale, /* 相对变化值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
explicit ScaleBy(
|
ScaleBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float scale_x, /* 横向缩放相对变化值 */
|
float scale_x, /* 横向缩放相对变化值 */
|
||||||
float scale_y, /* 纵向缩放相对变化值 */
|
float scale_y, /* 纵向缩放相对变化值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -280,17 +276,17 @@ namespace easy2d
|
||||||
: public ScaleBy
|
: public ScaleBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ScaleTo(
|
ScaleTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float scale, /* 目标值 */
|
float scale, /* 目标值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
explicit ScaleTo(
|
ScaleTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float scale_x, /* 横向缩放目标值 */
|
float scale_x, /* 横向缩放目标值 */
|
||||||
float scale_y, /* 纵向缩放目标值 */
|
float scale_y, /* 纵向缩放目标值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -317,10 +313,10 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit OpacityBy(
|
OpacityBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float opacity, /* 相对变化值 */
|
float opacity, /* 相对变化值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -345,10 +341,10 @@ namespace easy2d
|
||||||
: public OpacityBy
|
: public OpacityBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit OpacityTo(
|
OpacityTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float opacity, /* 目标值 */
|
float opacity, /* 目标值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -377,7 +373,7 @@ namespace easy2d
|
||||||
// 创建淡入动作
|
// 创建淡入动作
|
||||||
explicit FadeIn(
|
explicit FadeIn(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -390,7 +386,7 @@ namespace easy2d
|
||||||
// 创建淡出动作
|
// 创建淡出动作
|
||||||
explicit FadeOut(
|
explicit FadeOut(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = Ease::Linear /* 速度变化 */
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -400,10 +396,10 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RotateBy(
|
RotateBy(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float rotation, /* 相对变化值 */
|
float rotation, /* 相对变化值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -428,10 +424,10 @@ namespace easy2d
|
||||||
: public RotateBy
|
: public RotateBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RotateTo(
|
RotateTo(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
float rotation, /* 目标值 */
|
float rotation, /* 目标值 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
@ -457,13 +453,13 @@ namespace easy2d
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PathAction(
|
PathAction(
|
||||||
Duration duration, /* 持续时长 */
|
Duration duration, /* 持续时长 */
|
||||||
GeometryPtr const& geo, /* 几何图形 */
|
GeometryPtr const& geo, /* 几何图形 */
|
||||||
bool rotating = false, /* 沿路径切线方向旋转 */
|
bool rotating = false, /* 沿路径切线方向旋转 */
|
||||||
float start = 0.f, /* 起点 */
|
float start = 0.f, /* 起点 */
|
||||||
float end = 1.f, /* 终点 */
|
float end = 1.f, /* 终点 */
|
||||||
EaseFunc func = EaseFunc::Linear /* 速度变化 */
|
EaseFunc func = nullptr /* 速度变化 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取该动作的拷贝对象
|
// 获取该动作的拷贝对象
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
if (frames_)
|
if (frames_)
|
||||||
{
|
{
|
||||||
return new (std::nothrow) Animation(duration_, frames_, ease_type_);
|
return new (std::nothrow) Animation(duration_, frames_, ease_func_);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +98,7 @@ namespace easy2d
|
||||||
FramesPtr frames = frames_->Reverse();
|
FramesPtr frames = frames_->Reverse();
|
||||||
if (frames)
|
if (frames)
|
||||||
{
|
{
|
||||||
return new (std::nothrow) Animation(duration_, frames, ease_type_);
|
return new (std::nothrow) Animation(duration_, frames, ease_func_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace easy2d
|
||||||
Animation(
|
Animation(
|
||||||
Duration duration, /* 动画时长 */
|
Duration duration, /* 动画时长 */
|
||||||
FramesPtr const& frames, /* 帧集合 */
|
FramesPtr const& frames, /* 帧集合 */
|
||||||
EaseFunc func = EaseFunc::Linear
|
EaseFunc func = nullptr /* ヒルカネア莉ッ */
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~Animation();
|
virtual ~Animation();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
#include "Transition.h"
|
#include "Transition.h"
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <imm.h>
|
#include <imm.h>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#pragma comment (lib ,"imm32.lib")
|
#pragma comment (lib ,"imm32.lib")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,6 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
auto rt = RenderSystem::Instance();
|
auto rt = RenderSystem::Instance();
|
||||||
|
|
||||||
rt->SetTransform(Matrix{});
|
|
||||||
|
|
||||||
rt->GetSolidBrush()->SetColor(Color(0.0f, 0.0f, 0.0f, 0.5f));
|
rt->GetSolidBrush()->SetColor(Color(0.0f, 0.0f, 0.0f, 0.5f));
|
||||||
|
|
||||||
rt->GetRenderTarget()->FillRoundedRectangle(
|
rt->GetRenderTarget()->FillRoundedRectangle(
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ namespace easy2d
|
||||||
using String = std::wstring;
|
using String = std::wstring;
|
||||||
using StringStream = std::wstringstream;
|
using StringStream = std::wstringstream;
|
||||||
|
|
||||||
|
template<typename Type1, typename Type2>
|
||||||
|
using Pair = std::pair<Type1, Type2>;
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
using Array = std::vector<Type>;
|
using Array = std::vector<Type>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ namespace easy2d
|
||||||
// 转为字符串
|
// 转为字符串
|
||||||
std::wstring ToString() const;
|
std::wstring ToString() const;
|
||||||
|
|
||||||
|
inline operator bool() const { return !IsZero(); }
|
||||||
|
|
||||||
bool operator== (const Duration &) const;
|
bool operator== (const Duration &) const;
|
||||||
bool operator!= (const Duration &) const;
|
bool operator!= (const Duration &) const;
|
||||||
bool operator> (const Duration &) const;
|
bool operator> (const Duration &) const;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ namespace easy2d
|
||||||
, width_(0)
|
, width_(0)
|
||||||
, height_(0)
|
, height_(0)
|
||||||
, device_name_(nullptr)
|
, device_name_(nullptr)
|
||||||
|
, is_fullscreen_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@ namespace easy2d
|
||||||
|
|
||||||
inline float GetBottom() const { return origin.y + size.y; }
|
inline float GetBottom() const { return origin.y + size.y; }
|
||||||
|
|
||||||
|
inline bool IsEmpty() const { return origin.IsOrigin() && size.IsOrigin(); }
|
||||||
|
|
||||||
// 判断点是否在矩形内
|
// 判断点是否在矩形内
|
||||||
inline bool ContainsPoint(const Vector2& point) const
|
inline bool ContainsPoint(const Vector2& point) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ namespace easy2d
|
||||||
return math::Sqrt(x * x + y * y);
|
return math::Sqrt(x * x + y * y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsOrigin() const
|
||||||
|
{
|
||||||
|
return (x == 0) && (y == 0);
|
||||||
|
}
|
||||||
|
|
||||||
inline const Vector2 operator + (const Vector2 & other) const
|
inline const Vector2 operator + (const Vector2 & other) const
|
||||||
{
|
{
|
||||||
return Vector2(x + other.x, y + other.y);
|
return Vector2(x + other.x, y + other.y);
|
||||||
|
|
|
||||||
|
|
@ -43,25 +43,57 @@ namespace easy2d
|
||||||
|
|
||||||
void ResLoader::AddImage(String const& id, Resource const& image)
|
void ResLoader::AddImage(String const& id, Resource const& image)
|
||||||
{
|
{
|
||||||
auto path = Search(image.GetFileName(), search_paths_);
|
String path = Search(image.GetFileName(), search_paths_);
|
||||||
res_.insert(std::make_pair(id, ImagePtr(new Image(path.c_str()))));
|
ImagePtr ptr = new Image(path.c_str());
|
||||||
|
res_.insert(std::make_pair(id, ptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResLoader::AddImage(String const & id, ImagePtr const & image)
|
||||||
|
{
|
||||||
|
res_.insert(std::make_pair(id, image));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResLoader::AddFrames(String const& id, Array<Resource> const& images)
|
void ResLoader::AddFrames(String const& id, Array<Resource> const& images)
|
||||||
{
|
{
|
||||||
auto frames = FramesPtr(new Frames);
|
FramesPtr frames = new Frames;
|
||||||
for (const auto& image : images)
|
for (const auto& image : images)
|
||||||
{
|
{
|
||||||
auto path = Search(image.GetFileName(), search_paths_);
|
String path = Search(image.GetFileName(), search_paths_);
|
||||||
frames->Add(ImagePtr(new Image(path.c_str())));
|
ImagePtr ptr = new Image(path.c_str());
|
||||||
|
frames->Add(ptr);
|
||||||
|
}
|
||||||
|
res_.insert(std::make_pair(id, frames));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResLoader::AddFrames(String const& id, Array<ImagePtr> const& images)
|
||||||
|
{
|
||||||
|
FramesPtr frames = new Frames;
|
||||||
|
for (const auto& image : images)
|
||||||
|
frames->Add(image);
|
||||||
|
res_.insert(std::make_pair(id, frames));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResLoader::AddFrames(String const& id, Array<std::pair<Resource, Rect>> const& images)
|
||||||
|
{
|
||||||
|
FramesPtr frames = new Frames;
|
||||||
|
for (const auto& pair : images)
|
||||||
|
{
|
||||||
|
String path = Search(pair.first.GetFileName(), search_paths_);
|
||||||
|
ImagePtr image = new Image(path.c_str());
|
||||||
|
if (!pair.second.IsEmpty())
|
||||||
|
{
|
||||||
|
image->Crop(pair.second);
|
||||||
|
}
|
||||||
|
frames->Add(image);
|
||||||
}
|
}
|
||||||
res_.insert(std::make_pair(id, frames));
|
res_.insert(std::make_pair(id, frames));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResLoader::AddMusic(String const & id, Resource const & music)
|
void ResLoader::AddMusic(String const & id, Resource const & music)
|
||||||
{
|
{
|
||||||
auto path = Search(music.GetFileName(), search_paths_);
|
String path = Search(music.GetFileName(), search_paths_);
|
||||||
res_.insert(std::make_pair(id, MusicPtr(new Music(path.c_str()))));
|
MusicPtr ptr = new Music(path.c_str());
|
||||||
|
res_.insert(std::make_pair(id, ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResLoader::AddObj(String const& id, ObjectPtr const& obj)
|
void ResLoader::AddObj(String const& id, ObjectPtr const& obj)
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,14 @@ namespace easy2d
|
||||||
public:
|
public:
|
||||||
void AddImage(String const& id, Resource const& image);
|
void AddImage(String const& id, Resource const& image);
|
||||||
|
|
||||||
|
void AddImage(String const& id, ImagePtr const& image);
|
||||||
|
|
||||||
void AddFrames(String const& id, Array<Resource> const& images);
|
void AddFrames(String const& id, Array<Resource> const& images);
|
||||||
|
|
||||||
|
void AddFrames(String const& id, Array<Pair<Resource, Rect>> const& images);
|
||||||
|
|
||||||
|
void AddFrames(String const& id, Array<ImagePtr> const& images);
|
||||||
|
|
||||||
void AddMusic(String const& id, Resource const& music);
|
void AddMusic(String const& id, Resource const& music);
|
||||||
|
|
||||||
void AddObj(String const& id, ObjectPtr const& obj);
|
void AddObj(String const& id, ObjectPtr const& obj);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue