mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2025-09-06 08:20:15 +02:00
Main menu bar doesn't cover game area
This commit is contained in:
parent
1525cfae75
commit
f46f1f5365
4 changed files with 13 additions and 1 deletions
|
@ -110,6 +110,8 @@ void fullscrn::window_size_changed()
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
SDL_GetRendererOutputSize(winmain::Renderer, &width, &height);
|
SDL_GetRendererOutputSize(winmain::Renderer, &width, &height);
|
||||||
|
int menuHeight = options::Options.ShowMenu ? winmain::MainMenuHeight : 0;
|
||||||
|
height -= menuHeight;
|
||||||
auto res = &resolution_array[resolution];
|
auto res = &resolution_array[resolution];
|
||||||
ScaleX = static_cast<float>(width) / res->TableWidth;
|
ScaleX = static_cast<float>(width) / res->TableWidth;
|
||||||
ScaleY = static_cast<float>(height) / res->TableHeight;
|
ScaleY = static_cast<float>(height) / res->TableHeight;
|
||||||
|
@ -124,7 +126,7 @@ void fullscrn::window_size_changed()
|
||||||
|
|
||||||
render::DestinationRect = SDL_Rect
|
render::DestinationRect = SDL_Rect
|
||||||
{
|
{
|
||||||
OffsetX, OffsetY,
|
OffsetX, OffsetY + menuHeight,
|
||||||
width - OffsetX * 2, height - OffsetY * 2
|
width - OffsetX * 2, height - OffsetY * 2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,7 @@ void options::toggle(Menu1 uIDCheckItem)
|
||||||
return;
|
return;
|
||||||
case Menu1::Show_Menu:
|
case Menu1::Show_Menu:
|
||||||
Options.ShowMenu = Options.ShowMenu == 0;
|
Options.ShowMenu = Options.ShowMenu == 0;
|
||||||
|
fullscrn::window_size_changed();
|
||||||
return;
|
return;
|
||||||
case Menu1::Full_Screen:
|
case Menu1::Full_Screen:
|
||||||
Options.FullScreen ^= true;
|
Options.FullScreen ^= true;
|
||||||
|
|
|
@ -37,6 +37,7 @@ bool winmain::LaunchBallEnabled = true;
|
||||||
bool winmain::HighScoresEnabled = true;
|
bool winmain::HighScoresEnabled = true;
|
||||||
bool winmain::DemoActive = false;
|
bool winmain::DemoActive = false;
|
||||||
char* winmain::BasePath;
|
char* winmain::BasePath;
|
||||||
|
int winmain::MainMenuHeight = 0;
|
||||||
std::string winmain::FpsDetails;
|
std::string winmain::FpsDetails;
|
||||||
double winmain::UpdateToFrameRatio;
|
double winmain::UpdateToFrameRatio;
|
||||||
winmain::DurationMs winmain::TargetFrameTime;
|
winmain::DurationMs winmain::TargetFrameTime;
|
||||||
|
@ -341,6 +342,13 @@ void winmain::RenderUi()
|
||||||
|
|
||||||
if (ImGui::BeginMainMenuBar())
|
if (ImGui::BeginMainMenuBar())
|
||||||
{
|
{
|
||||||
|
if (MainMenuHeight == 0)
|
||||||
|
{
|
||||||
|
// Get the height of the main menu bar and update screen coordinates
|
||||||
|
MainMenuHeight = static_cast<int>(ImGui::GetWindowSize().y);
|
||||||
|
fullscrn::window_size_changed();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Game"))
|
if (ImGui::BeginMenu("Game"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("New Game", "F2"))
|
if (ImGui::MenuItem("New Game", "F2"))
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
static bool HighScoresEnabled;
|
static bool HighScoresEnabled;
|
||||||
static bool DemoActive;
|
static bool DemoActive;
|
||||||
static char* BasePath;
|
static char* BasePath;
|
||||||
|
static int MainMenuHeight;
|
||||||
|
|
||||||
static int WinMain(LPCSTR lpCmdLine);
|
static int WinMain(LPCSTR lpCmdLine);
|
||||||
static int event_handler(const SDL_Event* event);
|
static int event_handler(const SDL_Event* event);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue