2017-09-27 17:56:28 +08:00
|
|
|
|
#include "..\easy2d.h"
|
|
|
|
|
|
|
|
|
|
|
|
ActionDelay::ActionDelay(float duration)
|
|
|
|
|
|
{
|
|
|
|
|
|
setInterval(UINT(duration * 1000));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ActionDelay::~ActionDelay()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-30 16:18:45 +08:00
|
|
|
|
ActionDelay * ActionDelay::copy() const
|
2017-09-27 17:56:28 +08:00
|
|
|
|
{
|
2017-09-30 16:18:45 +08:00
|
|
|
|
return new ActionDelay(m_nMilliSeconds / 1000.0f);
|
2017-09-27 17:56:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ActionDelay::_init()
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
QueryPerformanceCounter(&m_nLast);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-08 12:30:45 +08:00
|
|
|
|
void ActionDelay::_exec(LARGE_INTEGER nNow)
|
2017-09-27 17:56:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>㹻
|
|
|
|
|
|
if (nNow.QuadPart - m_nLast.QuadPart > m_nAnimationInterval.QuadPart)
|
|
|
|
|
|
{
|
2017-10-08 12:30:45 +08:00
|
|
|
|
this->stop();
|
2017-09-27 17:56:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ActionDelay::_reset()
|
|
|
|
|
|
{
|
2017-10-08 12:30:45 +08:00
|
|
|
|
Action::_reset();
|
2017-09-27 17:56:28 +08:00
|
|
|
|
// <20><><EFBFBD>¼<EFBFBD>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
QueryPerformanceCounter(&m_nLast);
|
|
|
|
|
|
}
|