From 7de0b165f196cb0c1f983b6d2ab26ef9791a2d36 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 2 Oct 2024 14:52:30 +0200 Subject: Do a single logic update each frame The logic update now uses Time::deltaTimeMs() where needed to make it framerate-independent. This means there will no longer be multiple logic calls per frame (as was usually the case with logic ticking at 100 fps whereas the game would generally run at 60 fps). At the same time, the game can be more precise at higher framerates and should now run smoother at 144 Hz, for example. Previously the game would sometimes skip logic ticks at that rate. This change affects: * Updating of animations * Being movement speed * More moving of manual time variables to Timer Notoriously, the particle system still does 100 ticks/second. --- src/simpleanimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/simpleanimation.cpp') diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 2d3634bb..161b50c9 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -71,11 +71,11 @@ void SimpleAnimation::setFrame(int frame) mCurrentFrame = mAnimation.getFrame(mAnimationPhase); } -void SimpleAnimation::update(int timePassed) +void SimpleAnimation::update(int dt) { if (mInitialized) { - mAnimationTime += timePassed; + mAnimationTime += dt; while (mAnimationTime > mCurrentFrame->delay && mCurrentFrame->delay > 0) { -- cgit v1.2.3-70-g09d2