2017-10-19 00:50:04 +08:00
|
|
|
|
#include "..\eactions.h"
|
|
|
|
|
|
#include "..\Win\winbase.h"
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
e2d::EAnimation::EAnimation(float duration)
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
m_nDuration = 0;
|
|
|
|
|
|
m_nTotalDuration = UINT(duration * 1000);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
bool e2d::EAnimation::_isEnd() const
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
return m_nDuration >= m_nTotalDuration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
void e2d::EAnimation::_init()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
EAction::_init();
|
|
|
|
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
m_nLast = GetNow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
bool e2d::EAnimation::_isDelayEnough()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>㹻
|
|
|
|
|
|
if (GetInterval(m_nLast) > m_nAnimationInterval)
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD>¼<EFBFBD>¼ʱ<C2BC><CAB1>
|
|
|
|
|
|
m_nLast += milliseconds(m_nAnimationInterval);
|
|
|
|
|
|
m_nDuration += m_nAnimationInterval;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
void e2d::EAnimation::_reset()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
EAction::_reset();
|
|
|
|
|
|
m_nDuration = 0;
|
|
|
|
|
|
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
m_nLast = GetNow();
|
|
|
|
|
|
}
|