mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Merge pull request #14 from prototux/option_nogui
Add an option to show or hide the menu
This commit is contained in:
commit
593b4d161c
@ -67,6 +67,7 @@ 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;
|
||||||
@ -90,6 +91,7 @@ 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);
|
||||||
@ -120,6 +122,7 @@ 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);
|
||||||
@ -188,6 +191,9 @@ void options::toggle(Menu1 uIDCheckItem)
|
|||||||
else
|
else
|
||||||
midi::play_pb_theme(0);
|
midi::play_pb_theme(0);
|
||||||
return;
|
return;
|
||||||
|
case Menu1::Show_Menu:
|
||||||
|
Options.ShowMenu = Options.ShowMenu == 0;
|
||||||
|
return;
|
||||||
case Menu1::Full_Screen:
|
case Menu1::Full_Screen:
|
||||||
newValue = Options.FullScreen == 0;
|
newValue = Options.FullScreen == 0;
|
||||||
Options.FullScreen = Options.FullScreen == 0;
|
Options.FullScreen = Options.FullScreen == 0;
|
||||||
|
@ -20,6 +20,7 @@ enum class Menu1:int
|
|||||||
TwoPlayers = 409,
|
TwoPlayers = 409,
|
||||||
ThreePlayers = 410,
|
ThreePlayers = 410,
|
||||||
FourPlayers = 411,
|
FourPlayers = 411,
|
||||||
|
Show_Menu = 412,
|
||||||
MaximumResolution = 500,
|
MaximumResolution = 500,
|
||||||
R640x480 = 501,
|
R640x480 = 501,
|
||||||
R800x600 = 502,
|
R800x600 = 502,
|
||||||
@ -32,6 +33,7 @@ struct optionsStruct
|
|||||||
{
|
{
|
||||||
int Sounds;
|
int Sounds;
|
||||||
int Music;
|
int Music;
|
||||||
|
int ShowMenu;
|
||||||
int FullScreen;
|
int FullScreen;
|
||||||
int Players;
|
int Players;
|
||||||
int LeftFlipperKey;
|
int LeftFlipperKey;
|
||||||
|
@ -244,16 +244,23 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||||||
if (UpdateToFrameCounter >= UpdateToFrameRatio)
|
if (UpdateToFrameCounter >= UpdateToFrameRatio)
|
||||||
{
|
{
|
||||||
UpdateToFrameCounter -= UpdateToFrameRatio;
|
UpdateToFrameCounter -= UpdateToFrameRatio;
|
||||||
|
|
||||||
|
if (options::Options.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)
|
||||||
|
{
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGuiSDL::Render(ImGui::GetDrawData());
|
ImGuiSDL::Render(ImGui::GetDrawData());
|
||||||
|
}
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
frameCounter++;
|
frameCounter++;
|
||||||
@ -353,6 +360,10 @@ void winmain::RenderUi()
|
|||||||
|
|
||||||
if (ImGui::BeginMenu("Options"))
|
if (ImGui::BeginMenu("Options"))
|
||||||
{
|
{
|
||||||
|
if (ImGui::MenuItem("Show Menu", "F9", options::Options.ShowMenu))
|
||||||
|
{
|
||||||
|
options::toggle(Menu1::Show_Menu);
|
||||||
|
}
|
||||||
if (ImGui::MenuItem("Full Screen", "F4", options::Options.FullScreen))
|
if (ImGui::MenuItem("Full Screen", "F4", options::Options.FullScreen))
|
||||||
{
|
{
|
||||||
options::toggle(Menu1::Full_Screen);
|
options::toggle(Menu1::Full_Screen);
|
||||||
@ -573,6 +584,9 @@ int winmain::event_handler(const SDL_Event* event)
|
|||||||
pause();
|
pause();
|
||||||
options::keyboard();
|
options::keyboard();
|
||||||
break;
|
break;
|
||||||
|
case SDLK_F9:
|
||||||
|
options::toggle(Menu1::Show_Menu);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user