41 lines
632 B
C++
41 lines
632 B
C++
|
|
#include "..\easy2d.h"
|
|||
|
|
|
|||
|
|
ActionDelay::ActionDelay(float duration)
|
|||
|
|
{
|
|||
|
|
setInterval(UINT(duration * 1000));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ActionDelay::~ActionDelay()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ActionDelay * easy2d::ActionDelay::copy()
|
|||
|
|
{
|
|||
|
|
return new ActionDelay(*this);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ActionDelay::_init()
|
|||
|
|
{
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|||
|
|
QueryPerformanceCounter(&m_nLast);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool ActionDelay::_exec(LARGE_INTEGER nNow)
|
|||
|
|
{
|
|||
|
|
if (m_bStop) return true;
|
|||
|
|
if (!m_bRunning) return false;
|
|||
|
|
|
|||
|
|
// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>㹻
|
|||
|
|
if (nNow.QuadPart - m_nLast.QuadPart > m_nAnimationInterval.QuadPart)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ActionDelay::_reset()
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>¼<EFBFBD>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|||
|
|
QueryPerformanceCounter(&m_nLast);
|
|||
|
|
}
|