From 2aca0b6b28d002a7d2cfe2217232f221d5203845 Mon Sep 17 00:00:00 2001 From: elasota Date: Tue, 10 Nov 2020 19:02:18 -0500 Subject: [PATCH] Move high scores up to fix overlap on some mobile resolutions --- GpApp/HighScores.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/GpApp/HighScores.cpp b/GpApp/HighScores.cpp index 73e0e79..3a33c7a 100644 --- a/GpApp/HighScores.cpp +++ b/GpApp/HighScores.cpp @@ -17,8 +17,10 @@ #include "FileManager.h" #include "FontFamily.h" #include "FontManager.h" +#include "HostDisplayDriver.h" #include "HostSystemServices.h" #include "House.h" +#include "IGpDisplayDriver.h" #include "GpIOStream.h" #include "MainWindow.h" #include "PLStandardColors.h" @@ -27,6 +29,7 @@ #include "RenderedFont.h" #include "ResolveCachingColor.h" #include "Utilities.h" +#include "Vec2i.h" #include "WindowManager.h" #define kHighScoresPictID 1994 @@ -499,6 +502,19 @@ int16_t NameFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt) return -1; } +void MoveDialogToTopOfScreen(Dialog *dial) +{ + Window *window = dial->GetWindow(); + PortabilityLayer::Vec2i pos = window->GetPosition(); + + unsigned int height = 0; + PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &height); + + pos.m_y = (height - window->GetDrawSurface()->m_port.GetRect().Height()) / 8; + + dial->GetWindow()->SetPosition(pos); +} + //-------------------------------------------------------------- GetHighScoreName // Brings up a dialog to get player's name (due to a high score). @@ -526,6 +542,9 @@ void GetHighScoreName (short place) UpdateNameDialog(theDial); + if (PortabilityLayer::HostSystemServices::GetInstance()->IsTextInputObstructive()) + MoveDialogToTopOfScreen(theDial); + Window *exclStack = theDial->GetWindow(); wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms @@ -636,6 +655,9 @@ void GetHighScoreBanner (void) UpdateBannerDialog(theDial); + if (PortabilityLayer::HostSystemServices::GetInstance()->IsTextInputObstructive()) + MoveDialogToTopOfScreen(theDial); + Window *exclStack = theDial->GetWindow(); wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms