mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-24 01:40:18 +01:00
parent
81c2034a16
commit
c3b6daefc9
3 changed files with 11 additions and 1 deletions
|
@ -74,6 +74,7 @@ void options::init()
|
|||
Options.UpdatesPerSecond = std::min(MaxUps, std::max(MinUps, get_int("Updates Per Second", DefUps)));
|
||||
Options.UpdatesPerSecond = std::max(Options.UpdatesPerSecond, Options.FramesPerSecond);
|
||||
Options.ShowMenu = get_int("ShowMenu", true);
|
||||
Options.UncappedUpdatesPerSecond = get_int("Uncapped Updates Per Second", false);
|
||||
|
||||
winmain::UpdateFrameRate();
|
||||
|
||||
|
@ -104,6 +105,7 @@ void options::uninit()
|
|||
set_int("Frames Per Second", Options.FramesPerSecond);
|
||||
set_int("Updates Per Second", Options.UpdatesPerSecond);
|
||||
set_int("ShowMenu", Options.ShowMenu);
|
||||
set_int("Uncapped Updates Per Second", Options.UncappedUpdatesPerSecond);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ struct optionsStruct
|
|||
int FramesPerSecond;
|
||||
int UpdatesPerSecond;
|
||||
bool ShowMenu;
|
||||
bool UncappedUpdatesPerSecond;
|
||||
};
|
||||
|
||||
struct ControlRef
|
||||
|
|
|
@ -269,7 +269,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||
auto targetTimeDelta = TargetFrameTime - DurationMs(updateEnd - frameStart) - sleepRemainder;
|
||||
|
||||
TimePoint frameEnd;
|
||||
if (targetTimeDelta > DurationMs::zero())
|
||||
if (targetTimeDelta > DurationMs::zero() && !options::Options.UncappedUpdatesPerSecond)
|
||||
{
|
||||
std::this_thread::sleep_for(targetTimeDelta);
|
||||
frameEnd = Clock::now();
|
||||
|
@ -459,6 +459,7 @@ void winmain::RenderUi()
|
|||
"%.2f", ImGuiSliderFlags_AlwaysClamp);
|
||||
ImGui::Separator();
|
||||
|
||||
char buffer[80]{};
|
||||
auto changed = false;
|
||||
if (ImGui::MenuItem("Set Default UPS/FPS"))
|
||||
{
|
||||
|
@ -480,6 +481,12 @@ void winmain::RenderUi()
|
|||
options::Options.UpdatesPerSecond = std::max(options::Options.UpdatesPerSecond,
|
||||
options::Options.FramesPerSecond);
|
||||
}
|
||||
snprintf(buffer, sizeof buffer - 1, "Uncapped UPS (FPS ratio %02.02f)", UpdateToFrameRatio);
|
||||
if (ImGui::MenuItem(buffer, nullptr, options::Options.UncappedUpdatesPerSecond))
|
||||
{
|
||||
options::Options.UncappedUpdatesPerSecond ^= true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
UpdateFrameRate();
|
||||
|
|
Loading…
Reference in a new issue