From b10fefd5afbceca0b0a737f3c1691fd20109508d Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Mon, 17 Jan 2022 09:54:28 +0300 Subject: [PATCH] Improved TargetUps comments. --- SpaceCadetPinball/pb.cpp | 2 +- SpaceCadetPinball/winmain.cpp | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/SpaceCadetPinball/pb.cpp b/SpaceCadetPinball/pb.cpp index fe98f42..6a4282f 100644 --- a/SpaceCadetPinball/pb.cpp +++ b/SpaceCadetPinball/pb.cpp @@ -270,10 +270,10 @@ void pb::frame(float dtMilliSec) // Retained render prevents frame skip. The next best thing - complete refresh at fixed rate. render::update(false); + // Redraw is slower, as a compromise it is done at FPS = UPS / 2 auto targetFps = options::Options.TargetUps / 2.0f; targetFps = max(targetFps, 60.0f); // at least 60 - // Frame time at 60 FPS = 16.(6) ms auto targetTime = 1000.0f / targetFps; frameTime += dtMilliSec; diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index cac5784..92a7a69 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -224,12 +224,8 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi pb::toggle_demo(); else pb::replay_level(0); - - // To have a smooth display, Updates Per Sec (UPS) should be fps*2. - // Defaulted to 125 UPS, to leave some time for rendering. - float TargetFrameTime = 1000.0f / options::Options.TargetUps; - TargetFrameTime = max(TargetFrameTime, 1); + float TargetFrameTime = 1000.0f / options::Options.TargetUps; DWORD someTimeCounter = 300u, prevTime = 0u, frameStart = timeGetTime(); float sleepRemainder = 0, frameDuration = TargetFrameTime; while (true)