1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Framerate manager is now in a separate file and private member of GH

This commit is contained in:
Ivan Savenko
2023-05-13 00:15:48 +03:00
parent 0a874cd89e
commit 03df274450
18 changed files with 156 additions and 111 deletions

View File

@ -59,14 +59,14 @@ void ProjectileMissile::show(Canvas & canvas)
canvas.draw(image, pos);
}
float timePassed = GH.mainFPSmng->getElapsedMilliseconds() / 1000.f;
float timePassed = GH.getFrameDeltaMilliseconds() / 1000.f;
progress += timePassed * speed;
}
void ProjectileAnimatedMissile::show(Canvas & canvas)
{
ProjectileMissile::show(canvas);
frameProgress += AnimationControls::getSpellEffectSpeed() * GH.mainFPSmng->getElapsedMilliseconds() / 1000;
frameProgress += AnimationControls::getSpellEffectSpeed() * GH.getFrameDeltaMilliseconds() / 1000;
size_t animationSize = animation->size(reverse ? 1 : 0);
while (frameProgress > animationSize)
frameProgress -= animationSize;
@ -76,7 +76,7 @@ void ProjectileAnimatedMissile::show(Canvas & canvas)
void ProjectileCatapult::show(Canvas & canvas)
{
frameProgress += AnimationControls::getSpellEffectSpeed() * GH.mainFPSmng->getElapsedMilliseconds() / 1000;
frameProgress += AnimationControls::getSpellEffectSpeed() * GH.getFrameDeltaMilliseconds() / 1000;
int frameCounter = std::floor(frameProgress);
int frameIndex = (frameCounter + 1) % animation->size(0);
@ -91,7 +91,7 @@ void ProjectileCatapult::show(Canvas & canvas)
canvas.draw(image, pos);
}
float timePassed = GH.mainFPSmng->getElapsedMilliseconds() / 1000.f;
float timePassed = GH.getFrameDeltaMilliseconds() / 1000.f;
progress += timePassed * speed;
}
@ -136,7 +136,7 @@ void ProjectileRay::show(Canvas & canvas)
}
}
float timePassed = GH.mainFPSmng->getElapsedMilliseconds() / 1000.f;
float timePassed = GH.getFrameDeltaMilliseconds() / 1000.f;
progress += timePassed * speed;
}