diff --git a/core/base/ActionTween.h b/core/base/ActionTween.h index 6f710c02..a7074fe0 100644 --- a/core/base/ActionTween.h +++ b/core/base/ActionTween.h @@ -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, // 线性 diff --git a/core/base/Frames.h b/core/base/Frames.h index 9108e824..d82059bc 100644 --- a/core/base/Frames.h +++ b/core/base/Frames.h @@ -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 ); // 获取帧动画的拷贝对象 diff --git a/core/base/time.cpp b/core/base/time.cpp index 95460250..7babbe36 100644 --- a/core/base/time.cpp +++ b/core/base/time.cpp @@ -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(milliseconds_ * val)); @@ -265,11 +260,6 @@ namespace easy2d return Duration(static_cast(milliseconds_ * val)); } - const Duration Duration::operator/(float val) const - { - return Duration(static_cast(milliseconds_ / val)); - } - const Duration Duration::operator*(double val) const { return Duration(static_cast(milliseconds_ * val)); @@ -280,6 +270,16 @@ namespace easy2d return Duration(static_cast(milliseconds_ * val)); } + const Duration Duration::operator/(int val) const + { + return Duration(milliseconds_ / val); + } + + const Duration Duration::operator/(float val) const + { + return Duration(static_cast(milliseconds_ / val)); + } + const Duration Duration::operator/(double val) const { return Duration(static_cast(milliseconds_ / val)); diff --git a/core/base/time.h b/core/base/time.h index 15dab658..2375340d 100644 --- a/core/base/time.h +++ b/core/base/time.h @@ -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 );