This commit is contained in:
Haibo 2019-01-07 23:51:01 +08:00 committed by Nomango
parent 125c66df3e
commit c165db986b
3 changed files with 12 additions and 12 deletions

View File

@ -120,7 +120,7 @@ namespace easy2d
float GetOpacity() const { return opacity_; } float GetOpacity() const { return opacity_; }
// 삿혤긴뻣 // 삿혤긴뻣
Transform const& GetTransform() const { return transform_; } Transform const& GetTransform() const { return transform_; }
// 삿혤관鍋분 // 삿혤관鍋분
Rect GetBounds() const; Rect GetBounds() const;

View File

@ -35,7 +35,7 @@ namespace easy2d
{ {
} }
TimePoint::TimePoint(const Duration& dur) TimePoint::TimePoint(long long dur)
: dur(dur) : dur(dur)
{ {
} }
@ -52,29 +52,29 @@ namespace easy2d
const TimePoint TimePoint::operator+(const Duration & dur) const const TimePoint TimePoint::operator+(const Duration & dur) const
{ {
return TimePoint(dur + dur); return TimePoint{ (dur + dur).Milliseconds() };
} }
const TimePoint TimePoint::operator-(const Duration & dur) const const TimePoint TimePoint::operator-(const Duration & dur) const
{ {
return TimePoint(dur - dur); return TimePoint{ (dur - dur).Milliseconds() };
} }
TimePoint & TimePoint::operator+=(const Duration & other) TimePoint & TimePoint::operator+=(const Duration & other)
{ {
dur += other; dur += other.Milliseconds();
return (*this); return (*this);
} }
TimePoint & TimePoint::operator-=(const Duration &other) TimePoint & TimePoint::operator-=(const Duration &other)
{ {
dur -= other; dur -= other.Milliseconds();
return (*this); return (*this);
} }
const Duration TimePoint::operator-(const TimePoint & other) const const Duration TimePoint::operator-(const TimePoint & other) const
{ {
return dur - other.dur; return Duration{ dur - other.dur };
} }
TimePoint& TimePoint::operator=(const TimePoint & other) E2D_NOEXCEPT TimePoint& TimePoint::operator=(const TimePoint & other) E2D_NOEXCEPT
@ -449,7 +449,7 @@ namespace easy2d
const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL; const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL;
const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart; const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart;
return TimePoint{ Duration{ whole + part } }; return TimePoint{ whole + part };
} }
Duration easy2d::time::ParseDuration(const std::wstring & str) Duration easy2d::time::ParseDuration(const std::wstring & str)

View File

@ -44,7 +44,7 @@ namespace easy2d
public: public:
Duration(); Duration();
Duration( explicit Duration(
long long milliseconds long long milliseconds
); );
@ -147,7 +147,7 @@ namespace easy2d
TimePoint(); TimePoint();
explicit TimePoint( explicit TimePoint(
const Duration& long long
); );
TimePoint( TimePoint(
@ -159,7 +159,7 @@ namespace easy2d
); );
// 是否是零时 // 是否是零时
inline bool IsZero() const { return dur.IsZero(); } inline bool IsZero() const { return dur == 0; }
const TimePoint operator + (const Duration &) const; const TimePoint operator + (const Duration &) const;
const TimePoint operator - (const Duration &) const; const TimePoint operator - (const Duration &) const;
@ -173,7 +173,7 @@ namespace easy2d
TimePoint& operator = (TimePoint &&) E2D_NOEXCEPT; TimePoint& operator = (TimePoint &&) E2D_NOEXCEPT;
private: private:
Duration dur; long long dur;
}; };
// 获取当前时间 // 获取当前时间