42 lines
735 B
C++
42 lines
735 B
C++
|
|
#include "..\eactions.h"
|
|||
|
|
#include "..\Win\winbase.h"
|
|||
|
|
|
|||
|
|
e2d::EActionGradual::EActionGradual(float duration)
|
|||
|
|
{
|
|||
|
|
m_nDuration = 0;
|
|||
|
|
m_nTotalDuration = UINT(duration * 1000);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool e2d::EActionGradual::_isEnd() const
|
|||
|
|
{
|
|||
|
|
return m_nDuration >= m_nTotalDuration;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void e2d::EActionGradual::_init()
|
|||
|
|
{
|
|||
|
|
EAction::_init();
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|||
|
|
m_tLast = GetNow();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool e2d::EActionGradual::_isDelayEnough()
|
|||
|
|
{
|
|||
|
|
// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>㹻
|
|||
|
|
if (GetInterval(m_tLast) > m_nAnimationInterval)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>¼<EFBFBD>¼ʱ<C2BC><CAB1>
|
|||
|
|
m_tLast += milliseconds(m_nAnimationInterval);
|
|||
|
|
m_nDuration += m_nAnimationInterval;
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void e2d::EActionGradual::_reset()
|
|||
|
|
{
|
|||
|
|
EAction::_reset();
|
|||
|
|
m_nDuration = 0;
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|||
|
|
m_tLast = GetNow();
|
|||
|
|
}
|