diff --git a/src/PowderToy.h b/src/PowderToy.h index 6515c59a78..412167db5c 100644 --- a/src/PowderToy.h +++ b/src/PowderToy.h @@ -5,3 +5,4 @@ void EngineProcess(); void ClipboardPush(std::string text); std::string ClipboardPull(); int GetModifiers(); +bool LoadWindowPosition(int scale); diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index e0b7b6e784..24611a4948 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -46,6 +46,7 @@ extern "C" { #include "gui/game/GameView.h" #include "gui/dialogues/ErrorMessage.h" +#include "gui/dialogues/ConfirmPrompt.h" #include "gui/interface/Keys.h" #include "gui/Style.h" @@ -453,6 +454,7 @@ int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0; unsigned int lastTick = 0; float fps = 0, delta = 1.0f, inputScale = 1.0f; ui::Engine * engine = NULL; +bool showDoubleScreenDialog = false; float currentWidth, currentHeight; void EventProcess(SDL_Event event) @@ -573,6 +575,20 @@ void EventProcess(SDL_Event event) } } +void DoubleScreenDialog() +{ + std::stringstream message; + message << "Switching to double size mode since your screen was determined to be large enough: "; + message << desktopWidth << "x" << desktopHeight << " detected, " << WINDOWW*2 << "x" << WINDOWH*2 << " required"; + message << "\nTo undo this, hit Cancel. You can toggle double size mode in settings at any time."; + if (!ConfirmPrompt::Blocking("Large screen detected", message.str())) + { + Client::Ref().SetPref("Scale", 1); + engine->SetScale(1); + engine->CloseWindow(); + LoadWindowPosition(1); + } +} void EngineProcess() { double frameTimeAvg = 0.0f, correctedFrameTimeAvg = 0.0f; @@ -625,6 +641,11 @@ void EngineProcess() lastTick = frameStart; Client::Ref().Tick(); } + if (showDoubleScreenDialog) + { + showDoubleScreenDialog = false; + DoubleScreenDialog(); + } } #ifdef DEBUG std::cout << "Breaking out of EngineProcess" << std::endl; @@ -840,6 +861,7 @@ int main(int argc, char * argv[]) { tempScale = 2; Client::Ref().SetPref("Scale", 2); + showDoubleScreenDialog = true; } #ifdef WIN LoadWindowPosition(tempScale);