mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-22 08:50:18 +01:00
Compare commits
No commits in common. "b10fefd5afbceca0b0a737f3c1691fd20109508d" and "bd90b9d7125d7e41368f59f4f6995fcb245e93f2" have entirely different histories.
b10fefd5af
...
bd90b9d712
4 changed files with 4 additions and 12 deletions
|
@ -136,9 +136,6 @@ void options::ReadOptions()
|
||||||
Options.BottomTableBumpKey = get_int(nullptr, "Bottom Table Bump key", Options.BottomTableBumpKey);
|
Options.BottomTableBumpKey = get_int(nullptr, "Bottom Table Bump key", Options.BottomTableBumpKey);
|
||||||
Options.UniformScaling = get_int(nullptr, "Uniform scaling", true);
|
Options.UniformScaling = get_int(nullptr, "Uniform scaling", true);
|
||||||
Options.AlternativeRender = get_int(nullptr, "Alternative Render", false);
|
Options.AlternativeRender = get_int(nullptr, "Alternative Render", false);
|
||||||
Options.TargetUps = get_int(nullptr, "Target UPS", 120);
|
|
||||||
Options.TargetUps = max(60, Options.TargetUps);
|
|
||||||
Options.TargetUps = min(Options.TargetUps, 360);
|
|
||||||
|
|
||||||
auto defaultLanguage = Languages::English;
|
auto defaultLanguage = Languages::English;
|
||||||
auto language = static_cast<Languages>(get_int(nullptr, "Language", static_cast<int>(defaultLanguage)));
|
auto language = static_cast<Languages>(get_int(nullptr, "Language", static_cast<int>(defaultLanguage)));
|
||||||
|
@ -238,7 +235,6 @@ void options::uninit()
|
||||||
set_int(nullptr, "Uniform scaling", Options.UniformScaling);
|
set_int(nullptr, "Uniform scaling", Options.UniformScaling);
|
||||||
set_int(nullptr, "Alternative Render", Options.AlternativeRender);
|
set_int(nullptr, "Alternative Render", Options.AlternativeRender);
|
||||||
set_int(nullptr, "Language", static_cast<int>(Options.Language));
|
set_int(nullptr, "Language", static_cast<int>(Options.Language));
|
||||||
set_int(nullptr, "Target UPS", Options.TargetUps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void options::path_init(LPCSTR regPath)
|
void options::path_init(LPCSTR regPath)
|
||||||
|
|
|
@ -59,7 +59,6 @@ struct optionsStruct
|
||||||
int Resolution;
|
int Resolution;
|
||||||
bool UniformScaling;
|
bool UniformScaling;
|
||||||
bool AlternativeRender;
|
bool AlternativeRender;
|
||||||
int TargetUps;
|
|
||||||
Languages Language;
|
Languages Language;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -270,13 +270,9 @@ 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
|
// Frame time at 60 FPS = 16.(6) ms
|
||||||
auto targetFps = options::Options.TargetUps / 2.0f;
|
auto targetTime = 1000 / 60.0f;
|
||||||
targetFps = max(targetFps, 60.0f); // at least 60
|
|
||||||
|
|
||||||
auto targetTime = 1000.0f / targetFps;
|
|
||||||
frameTime += dtMilliSec;
|
frameTime += dtMilliSec;
|
||||||
|
|
||||||
if (frameTime >= targetTime)
|
if (frameTime >= targetTime)
|
||||||
{
|
{
|
||||||
frameTime = min(frameTime - targetTime, 100);
|
frameTime = min(frameTime - targetTime, 100);
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
|
const float TargetUPS = 120, TargetFrameTime = 1000 / TargetUPS;
|
||||||
|
|
||||||
HINSTANCE winmain::hinst = nullptr;
|
HINSTANCE winmain::hinst = nullptr;
|
||||||
HWND winmain::hwnd_frame = nullptr;
|
HWND winmain::hwnd_frame = nullptr;
|
||||||
HCURSOR winmain::mouse_hsave;
|
HCURSOR winmain::mouse_hsave;
|
||||||
|
@ -225,7 +227,6 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||||
else
|
else
|
||||||
pb::replay_level(0);
|
pb::replay_level(0);
|
||||||
|
|
||||||
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 a new issue