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::min(MaxUps, std::max(MinUps, get_int("Updates Per Second", DefUps)));
|
||||||
Options.UpdatesPerSecond = std::max(Options.UpdatesPerSecond, Options.FramesPerSecond);
|
Options.UpdatesPerSecond = std::max(Options.UpdatesPerSecond, Options.FramesPerSecond);
|
||||||
Options.ShowMenu = get_int("ShowMenu", true);
|
Options.ShowMenu = get_int("ShowMenu", true);
|
||||||
|
Options.UncappedUpdatesPerSecond = get_int("Uncapped Updates Per Second", false);
|
||||||
|
|
||||||
winmain::UpdateFrameRate();
|
winmain::UpdateFrameRate();
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ void options::uninit()
|
||||||
set_int("Frames Per Second", Options.FramesPerSecond);
|
set_int("Frames Per Second", Options.FramesPerSecond);
|
||||||
set_int("Updates Per Second", Options.UpdatesPerSecond);
|
set_int("Updates Per Second", Options.UpdatesPerSecond);
|
||||||
set_int("ShowMenu", Options.ShowMenu);
|
set_int("ShowMenu", Options.ShowMenu);
|
||||||
|
set_int("Uncapped Updates Per Second", Options.UncappedUpdatesPerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct optionsStruct
|
||||||
int FramesPerSecond;
|
int FramesPerSecond;
|
||||||
int UpdatesPerSecond;
|
int UpdatesPerSecond;
|
||||||
bool ShowMenu;
|
bool ShowMenu;
|
||||||
|
bool UncappedUpdatesPerSecond;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ControlRef
|
struct ControlRef
|
||||||
|
|
|
@ -269,7 +269,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||||
auto targetTimeDelta = TargetFrameTime - DurationMs(updateEnd - frameStart) - sleepRemainder;
|
auto targetTimeDelta = TargetFrameTime - DurationMs(updateEnd - frameStart) - sleepRemainder;
|
||||||
|
|
||||||
TimePoint frameEnd;
|
TimePoint frameEnd;
|
||||||
if (targetTimeDelta > DurationMs::zero())
|
if (targetTimeDelta > DurationMs::zero() && !options::Options.UncappedUpdatesPerSecond)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(targetTimeDelta);
|
std::this_thread::sleep_for(targetTimeDelta);
|
||||||
frameEnd = Clock::now();
|
frameEnd = Clock::now();
|
||||||
|
@ -459,6 +459,7 @@ void winmain::RenderUi()
|
||||||
"%.2f", ImGuiSliderFlags_AlwaysClamp);
|
"%.2f", ImGuiSliderFlags_AlwaysClamp);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
char buffer[80]{};
|
||||||
auto changed = false;
|
auto changed = false;
|
||||||
if (ImGui::MenuItem("Set Default UPS/FPS"))
|
if (ImGui::MenuItem("Set Default UPS/FPS"))
|
||||||
{
|
{
|
||||||
|
@ -480,6 +481,12 @@ void winmain::RenderUi()
|
||||||
options::Options.UpdatesPerSecond = std::max(options::Options.UpdatesPerSecond,
|
options::Options.UpdatesPerSecond = std::max(options::Options.UpdatesPerSecond,
|
||||||
options::Options.FramesPerSecond);
|
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)
|
if (changed)
|
||||||
{
|
{
|
||||||
UpdateFrameRate();
|
UpdateFrameRate();
|
||||||
|
|
Loading…
Reference in a new issue