1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Converted timer event into tick event that is called every frame

This commit is contained in:
Ivan Savenko
2023-03-22 23:09:43 +02:00
parent 8af76947cb
commit a8fe8c0f3b
8 changed files with 113 additions and 86 deletions

View File

@ -29,7 +29,6 @@ CIntObject::CIntObject(int used_, Point pos_):
active(active_m)
{
hovered = captureAllKeys = strongInterest = false;
toNextTick = timerDelay = 0;
used = used_;
recActions = defActions = GH.defActionsDef;
@ -60,24 +59,6 @@ CIntObject::~CIntObject()
parent_m->removeChild(this);
}
void CIntObject::setTimer(int msToTrigger)
{
if (!(active & TIME))
activate(TIME);
toNextTick = timerDelay = msToTrigger;
used |= TIME;
}
void CIntObject::onTimer(int timePassed)
{
toNextTick -= timePassed;
if (toNextTick < 0)
{
toNextTick += timerDelay;
tick();
}
}
void CIntObject::show(SDL_Surface * to)
{
if(defActions & UPDATE)