mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-25 12:12:32 +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.Sounds = 1;
|
||||||
Options.Music = 0;
|
Options.Music = 0;
|
||||||
Options.ShowMenu = 1;
|
|
||||||
Options.FullScreen = 0;
|
Options.FullScreen = 0;
|
||||||
Options.LeftFlipperKeyDft = SDLK_z;
|
Options.LeftFlipperKeyDft = SDLK_z;
|
||||||
Options.RightFlipperKeyDft = SDLK_SLASH;
|
Options.RightFlipperKeyDft = SDLK_SLASH;
|
||||||
@ -91,7 +90,6 @@ void options::init()
|
|||||||
Options.UniformScaling = true;
|
Options.UniformScaling = true;
|
||||||
Options.Sounds = get_int("Sounds", Options.Sounds);
|
Options.Sounds = get_int("Sounds", Options.Sounds);
|
||||||
Options.Music = get_int("Music", Options.Music);
|
Options.Music = get_int("Music", Options.Music);
|
||||||
Options.ShowMenu = get_int("ShowMenu", Options.ShowMenu);
|
|
||||||
Options.FullScreen = get_int("FullScreen", Options.FullScreen);
|
Options.FullScreen = get_int("FullScreen", Options.FullScreen);
|
||||||
Options.Players = get_int("Players", Options.Players);
|
Options.Players = get_int("Players", Options.Players);
|
||||||
Options.LeftFlipperKey = get_int("Left Flipper key", Options.LeftFlipperKey);
|
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.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::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);
|
||||||
|
|
||||||
winmain::UpdateFrameRate();
|
winmain::UpdateFrameRate();
|
||||||
|
|
||||||
@ -122,7 +121,6 @@ void options::uninit()
|
|||||||
{
|
{
|
||||||
set_int("Sounds", Options.Sounds);
|
set_int("Sounds", Options.Sounds);
|
||||||
set_int("Music", Options.Music);
|
set_int("Music", Options.Music);
|
||||||
set_int("ShowMenu", Options.ShowMenu);
|
|
||||||
set_int("FullScreen", Options.FullScreen);
|
set_int("FullScreen", Options.FullScreen);
|
||||||
set_int("Players", Options.Players);
|
set_int("Players", Options.Players);
|
||||||
set_int("Left Flipper key", Options.LeftFlipperKey);
|
set_int("Left Flipper key", Options.LeftFlipperKey);
|
||||||
@ -137,6 +135,7 @@ void options::uninit()
|
|||||||
set_int("Linear Filtering", Options.LinearFiltering);
|
set_int("Linear Filtering", Options.LinearFiltering);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ struct optionsStruct
|
|||||||
{
|
{
|
||||||
int Sounds;
|
int Sounds;
|
||||||
int Music;
|
int Music;
|
||||||
int ShowMenu;
|
|
||||||
int FullScreen;
|
int FullScreen;
|
||||||
int Players;
|
int Players;
|
||||||
int LeftFlipperKey;
|
int LeftFlipperKey;
|
||||||
@ -53,6 +52,7 @@ struct optionsStruct
|
|||||||
bool LinearFiltering;
|
bool LinearFiltering;
|
||||||
int FramesPerSecond;
|
int FramesPerSecond;
|
||||||
int UpdatesPerSecond;
|
int UpdatesPerSecond;
|
||||||
|
bool ShowMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,18 +245,19 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||||||
{
|
{
|
||||||
UpdateToFrameCounter -= UpdateToFrameRatio;
|
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_ImplSDL2_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
RenderUi();
|
RenderUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
render::PresentVScreen();
|
render::PresentVScreen();
|
||||||
|
|
||||||
if (options::Options.ShowMenu)
|
if (showMenu)
|
||||||
{
|
{
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGuiSDL::Render(ImGui::GetDrawData());
|
ImGuiSDL::Render(ImGui::GetDrawData());
|
||||||
|
Loading…
Reference in New Issue
Block a user