mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Improved TargetUps comments.
This commit is contained in:
parent
4f8dd98135
commit
b10fefd5af
@ -270,10 +270,10 @@ void pb::frame(float dtMilliSec)
|
|||||||
// Retained render prevents frame skip. The next best thing - complete refresh at fixed rate.
|
// Retained render prevents frame skip. The next best thing - complete refresh at fixed rate.
|
||||||
render::update(false);
|
render::update(false);
|
||||||
|
|
||||||
|
// Redraw is slower, as a compromise it is done at FPS = UPS / 2
|
||||||
auto targetFps = options::Options.TargetUps / 2.0f;
|
auto targetFps = options::Options.TargetUps / 2.0f;
|
||||||
targetFps = max(targetFps, 60.0f); // at least 60
|
targetFps = max(targetFps, 60.0f); // at least 60
|
||||||
|
|
||||||
// Frame time at 60 FPS = 16.(6) ms
|
|
||||||
auto targetTime = 1000.0f / targetFps;
|
auto targetTime = 1000.0f / targetFps;
|
||||||
frameTime += dtMilliSec;
|
frameTime += dtMilliSec;
|
||||||
|
|
||||||
|
@ -224,12 +224,8 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
pb::toggle_demo();
|
pb::toggle_demo();
|
||||||
else
|
else
|
||||||
pb::replay_level(0);
|
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();
|
DWORD someTimeCounter = 300u, prevTime = 0u, frameStart = timeGetTime();
|
||||||
float sleepRemainder = 0, frameDuration = TargetFrameTime;
|
float sleepRemainder = 0, frameDuration = TargetFrameTime;
|
||||||
while (true)
|
while (true)
|
||||||
|
Loading…
Reference in New Issue
Block a user