From: <axl...@us...> - 2009-01-02 02:22:31
|
Revision: 140 http://hgengine.svn.sourceforge.net/hgengine/?rev=140&view=rev Author: axlecrusher Date: 2009-01-02 01:45:52 +0000 (Fri, 02 Jan 2009) Log Message: ----------- add ability to pause Modified Paths: -------------- Mercury2/src/MercuryTimer.cpp Mercury2/src/MercuryTimer.h Modified: Mercury2/src/MercuryTimer.cpp =================================================================== --- Mercury2/src/MercuryTimer.cpp 2009-01-02 01:20:29 UTC (rev 139) +++ Mercury2/src/MercuryTimer.cpp 2009-01-02 01:45:52 UTC (rev 140) @@ -15,7 +15,7 @@ } MercuryTimer::MercuryTimer() - :m_lastTouch(0), m_thisTouch(0) + :m_lastTouch(0), m_thisTouch(0), m_paused(false) { if (m_initTime == 0) m_initTime = GetTimeInMicroSeconds(); @@ -33,6 +33,8 @@ { m_lastTouch = m_thisTouch; m_thisTouch = GetTimeInMicroSeconds() - m_initTime; + + if (m_paused) m_lastTouch = m_thisTouch; return Age(); } @@ -42,6 +44,11 @@ return Age(); } +void MercuryTimer::Pause() +{ + m_paused = !m_paused; +} + const MercuryTimer& MercuryTimer::operator=(const MercuryTimer& t) { m_lastTouch = t.m_lastTouch; Modified: Mercury2/src/MercuryTimer.h =================================================================== --- Mercury2/src/MercuryTimer.h 2009-01-02 01:20:29 UTC (rev 139) +++ Mercury2/src/MercuryTimer.h 2009-01-02 01:45:52 UTC (rev 140) @@ -21,12 +21,15 @@ ///time between last last touch and this touch inline float Age() { return (m_thisTouch - m_lastTouch)/1000000.0f; } + void Pause(); + const MercuryTimer& operator=(const MercuryTimer& t); private: static uint64_t m_initTime; uint64_t m_lastTouch; uint64_t m_thisTouch; + bool m_paused; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |