update time package

This commit is contained in:
Nomango 2019-01-14 20:38:49 +08:00 committed by Nomango
parent 22d9e843fe
commit fdcd9c9798
4 changed files with 22 additions and 21 deletions

View File

@ -26,7 +26,7 @@
namespace easy2d
{
// 缓动函数枚举
// More infomation about ease functions, see https://easings.net
// See https://easings.net for more information
enum class EaseFunc
{
Linear, // 线性

View File

@ -34,28 +34,28 @@ namespace easy2d
Frames();
explicit Frames(
Images const& frames /* 关键帧数组 */
Images const& frames /* 关键帧数组 */
);
explicit Frames(
Duration const& interval /* 帧间隔(秒) */
Duration const& interval /* 帧间隔 */
);
explicit Frames(
Duration const& interval, /* 帧间隔(秒) */
Images const& frames /* 关键帧数组 */
Duration const& interval, /* 帧间隔 */
Images const& frames /* 关键帧数组 */
);
virtual ~Frames();
// 添加关键帧
void Add(
SpImage const& frame /* 关键帧 */
SpImage const& frame
);
// 添加多个关键帧
void Add(
Images const& frames /* 关键帧数组 */
Images const& frames
);
// 获取帧间隔
@ -66,7 +66,7 @@ namespace easy2d
// 设置每一帧的时间间隔
void SetInterval(
Duration const& interval /* 帧间隔(秒) */
Duration const& interval
);
// 获取帧动画的拷贝对象

View File

@ -74,7 +74,7 @@ namespace easy2d
const Duration TimePoint::operator-(const TimePoint & other) const
{
return Duration{ dur - other.dur };
return Duration(dur - other.dur);
}
TimePoint& TimePoint::operator=(const TimePoint & other) E2D_NOEXCEPT
@ -250,11 +250,6 @@ namespace easy2d
return Duration(milliseconds_ * val);
}
const Duration Duration::operator/(int val) const
{
return Duration(milliseconds_ / val);
}
const Duration easy2d::time::Duration::operator*(unsigned long long val) const
{
return Duration(static_cast<long>(milliseconds_ * val));
@ -265,11 +260,6 @@ namespace easy2d
return Duration(static_cast<long>(milliseconds_ * val));
}
const Duration Duration::operator/(float val) const
{
return Duration(static_cast<long>(milliseconds_ / val));
}
const Duration Duration::operator*(double val) const
{
return Duration(static_cast<long>(milliseconds_ * val));
@ -280,6 +270,16 @@ namespace easy2d
return Duration(static_cast<long>(milliseconds_ * val));
}
const Duration Duration::operator/(int val) const
{
return Duration(milliseconds_ / val);
}
const Duration Duration::operator/(float val) const
{
return Duration(static_cast<long>(milliseconds_ / val));
}
const Duration Duration::operator/(double val) const
{
return Duration(static_cast<long>(milliseconds_ / val));

View File

@ -43,7 +43,7 @@ namespace easy2d
public:
Duration();
explicit Duration(
Duration(
long milliseconds
);
@ -110,6 +110,7 @@ namespace easy2d
long milliseconds_;
};
/* 预定义的时间段 */
extern const Duration Millisecond; // 毫秒
extern const Duration Second; // 秒
extern const Duration Minute; // 分钟
@ -136,7 +137,7 @@ namespace easy2d
public:
TimePoint();
explicit TimePoint(
TimePoint(
long
);