mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-25 04:02:30 +01:00
Fixed ShowMenu option interrupting ImGui::NewFrame.
This commit is contained in:
parent
593b4d161c
commit
b37f5d6d76
@ -67,7 +67,6 @@ void options::init()
|
||||
|
||||
Options.Sounds = 1;
|
||||
Options.Music = 0;
|
||||
Options.ShowMenu = 1;
|
||||
Options.FullScreen = 0;
|
||||
Options.LeftFlipperKeyDft = SDLK_z;
|
||||
Options.RightFlipperKeyDft = SDLK_SLASH;
|
||||
@ -91,7 +90,6 @@ void options::init()
|
||||
Options.UniformScaling = true;
|
||||
Options.Sounds = get_int("Sounds", Options.Sounds);
|
||||
Options.Music = get_int("Music", Options.Music);
|
||||
Options.ShowMenu = get_int("ShowMenu", Options.ShowMenu);
|
||||
Options.FullScreen = get_int("FullScreen", Options.FullScreen);
|
||||
Options.Players = get_int("Players", Options.Players);
|
||||
Options.LeftFlipperKey = get_int("Left Flipper key", Options.LeftFlipperKey);
|
||||
@ -107,6 +105,7 @@ void options::init()
|
||||
Options.FramesPerSecond = std::min(MaxFps, std::max(MinUps, get_int("Frames Per Second", DefFps)));
|
||||
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);
|
||||
|
||||
winmain::UpdateFrameRate();
|
||||
|
||||
@ -122,7 +121,6 @@ void options::uninit()
|
||||
{
|
||||
set_int("Sounds", Options.Sounds);
|
||||
set_int("Music", Options.Music);
|
||||
set_int("ShowMenu", Options.ShowMenu);
|
||||
set_int("FullScreen", Options.FullScreen);
|
||||
set_int("Players", Options.Players);
|
||||
set_int("Left Flipper key", Options.LeftFlipperKey);
|
||||
@ -137,6 +135,7 @@ void options::uninit()
|
||||
set_int("Linear Filtering", Options.LinearFiltering);
|
||||
set_int("Frames Per Second", Options.FramesPerSecond);
|
||||
set_int("Updates Per Second", Options.UpdatesPerSecond);
|
||||
set_int("ShowMenu", Options.ShowMenu);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,6 @@ struct optionsStruct
|
||||
{
|
||||
int Sounds;
|
||||
int Music;
|
||||
int ShowMenu;
|
||||
int FullScreen;
|
||||
int Players;
|
||||
int LeftFlipperKey;
|
||||
@ -53,6 +52,7 @@ struct optionsStruct
|
||||
bool LinearFiltering;
|
||||
int FramesPerSecond;
|
||||
int UpdatesPerSecond;
|
||||
bool ShowMenu;
|
||||
};
|
||||
|
||||
|
||||
|
@ -245,18 +245,19 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||
{
|
||||
UpdateToFrameCounter -= UpdateToFrameRatio;
|
||||
|
||||
if (options::Options.ShowMenu)
|
||||
// Option might be changed in RenderUi, unpairing NewFrame from EndFrame.
|
||||
auto showMenu = options::Options.ShowMenu;
|
||||
if (showMenu)
|
||||
{
|
||||
ImGui_ImplSDL2_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
RenderUi();
|
||||
}
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
render::PresentVScreen();
|
||||
|
||||
if (options::Options.ShowMenu)
|
||||
if (showMenu)
|
||||
{
|
||||
ImGui::Render();
|
||||
ImGuiSDL::Render(ImGui::GetDrawData());
|
||||
|
Loading…
Reference in New Issue
Block a user