update time package
This commit is contained in:
		
							parent
							
								
									22d9e843fe
								
							
						
					
					
						commit
						fdcd9c9798
					
				|  | @ -26,7 +26,7 @@ | ||||||
| namespace easy2d | namespace easy2d | ||||||
| { | { | ||||||
| 	// 缓动函数枚举
 | 	// 缓动函数枚举
 | ||||||
| 	// More infomation about ease functions, see https://easings.net
 | 	// See https://easings.net for more information
 | ||||||
| 	enum class EaseFunc | 	enum class EaseFunc | ||||||
| 	{ | 	{ | ||||||
| 		Linear,			// 线性
 | 		Linear,			// 线性
 | ||||||
|  |  | ||||||
|  | @ -38,11 +38,11 @@ namespace easy2d | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		explicit Frames( | 		explicit Frames( | ||||||
| 			Duration const& interval	/* 帧间隔(秒) */ | 			Duration const& interval	/* Ö¡¼ä¸ô */ | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		explicit Frames( | 		explicit Frames( | ||||||
| 			Duration const& interval,	/* 帧间隔(秒) */ | 			Duration const& interval,	/* Ö¡¼ä¸ô */ | ||||||
| 			Images const& frames		/* 关键帧数组 */ | 			Images const& frames		/* 关键帧数组 */ | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  | @ -50,12 +50,12 @@ namespace easy2d | ||||||
| 
 | 
 | ||||||
| 		// 添加关键帧
 | 		// 添加关键帧
 | ||||||
| 		void Add( | 		void Add( | ||||||
| 			SpImage const& frame		/* 关键帧 */ | 			SpImage const& frame | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		// 添加多个关键帧
 | 		// 添加多个关键帧
 | ||||||
| 		void Add( | 		void Add( | ||||||
| 			Images const& frames			/* 关键帧数组 */ | 			Images const& frames | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		// 获取帧间隔
 | 		// 获取帧间隔
 | ||||||
|  | @ -66,7 +66,7 @@ namespace easy2d | ||||||
| 
 | 
 | ||||||
| 		// 设置每一帧的时间间隔
 | 		// 设置每一帧的时间间隔
 | ||||||
| 		void SetInterval( | 		void SetInterval( | ||||||
| 			Duration const& interval	/* 帧间隔(秒) */ | 			Duration const& interval | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		// 获取帧动画的拷贝对象
 | 		// 获取帧动画的拷贝对象
 | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ namespace easy2d | ||||||
| 
 | 
 | ||||||
| 		const Duration TimePoint::operator-(const TimePoint & other) const | 		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 | 		TimePoint& TimePoint::operator=(const TimePoint & other) E2D_NOEXCEPT | ||||||
|  | @ -250,11 +250,6 @@ namespace easy2d | ||||||
| 			return Duration(milliseconds_ * val); | 			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 | 		const Duration easy2d::time::Duration::operator*(unsigned long long val) const | ||||||
| 		{ | 		{ | ||||||
| 			return Duration(static_cast<long>(milliseconds_ * val)); | 			return Duration(static_cast<long>(milliseconds_ * val)); | ||||||
|  | @ -265,11 +260,6 @@ namespace easy2d | ||||||
| 			return Duration(static_cast<long>(milliseconds_ * val)); | 			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 | 		const Duration Duration::operator*(double val) const | ||||||
| 		{ | 		{ | ||||||
| 			return Duration(static_cast<long>(milliseconds_ * val)); | 			return Duration(static_cast<long>(milliseconds_ * val)); | ||||||
|  | @ -280,6 +270,16 @@ namespace easy2d | ||||||
| 			return Duration(static_cast<long>(milliseconds_ * val)); | 			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 | 		const Duration Duration::operator/(double val) const | ||||||
| 		{ | 		{ | ||||||
| 			return Duration(static_cast<long>(milliseconds_ / val)); | 			return Duration(static_cast<long>(milliseconds_ / val)); | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ namespace easy2d | ||||||
| 		public: | 		public: | ||||||
| 			Duration(); | 			Duration(); | ||||||
| 
 | 
 | ||||||
| 			explicit Duration( | 			Duration( | ||||||
| 				long milliseconds | 				long milliseconds | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  | @ -110,6 +110,7 @@ namespace easy2d | ||||||
| 			long milliseconds_; | 			long milliseconds_; | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
|  | 		/* 预定义的时间段 */ | ||||||
| 		extern const Duration Millisecond;	// 毫秒
 | 		extern const Duration Millisecond;	// 毫秒
 | ||||||
| 		extern const Duration Second;		// 秒
 | 		extern const Duration Second;		// 秒
 | ||||||
| 		extern const Duration Minute;		// 分钟
 | 		extern const Duration Minute;		// 分钟
 | ||||||
|  | @ -136,7 +137,7 @@ namespace easy2d | ||||||
| 		public: | 		public: | ||||||
| 			TimePoint(); | 			TimePoint(); | ||||||
| 
 | 
 | ||||||
| 			explicit TimePoint( | 			TimePoint( | ||||||
| 				long | 				long | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue