mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 12:02:40 +02:00
show confirm dialog for double screen mode in case of false detections
This commit is contained in:
@@ -5,3 +5,4 @@ void EngineProcess();
|
|||||||
void ClipboardPush(std::string text);
|
void ClipboardPush(std::string text);
|
||||||
std::string ClipboardPull();
|
std::string ClipboardPull();
|
||||||
int GetModifiers();
|
int GetModifiers();
|
||||||
|
bool LoadWindowPosition(int scale);
|
||||||
|
@@ -46,6 +46,7 @@ extern "C" {
|
|||||||
#include "gui/game/GameView.h"
|
#include "gui/game/GameView.h"
|
||||||
|
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
|
|
||||||
@@ -453,6 +454,7 @@ int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0;
|
|||||||
unsigned int lastTick = 0;
|
unsigned int lastTick = 0;
|
||||||
float fps = 0, delta = 1.0f, inputScale = 1.0f;
|
float fps = 0, delta = 1.0f, inputScale = 1.0f;
|
||||||
ui::Engine * engine = NULL;
|
ui::Engine * engine = NULL;
|
||||||
|
bool showDoubleScreenDialog = false;
|
||||||
float currentWidth, currentHeight;
|
float currentWidth, currentHeight;
|
||||||
|
|
||||||
void EventProcess(SDL_Event event)
|
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()
|
void EngineProcess()
|
||||||
{
|
{
|
||||||
double frameTimeAvg = 0.0f, correctedFrameTimeAvg = 0.0f;
|
double frameTimeAvg = 0.0f, correctedFrameTimeAvg = 0.0f;
|
||||||
@@ -625,6 +641,11 @@ void EngineProcess()
|
|||||||
lastTick = frameStart;
|
lastTick = frameStart;
|
||||||
Client::Ref().Tick();
|
Client::Ref().Tick();
|
||||||
}
|
}
|
||||||
|
if (showDoubleScreenDialog)
|
||||||
|
{
|
||||||
|
showDoubleScreenDialog = false;
|
||||||
|
DoubleScreenDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Breaking out of EngineProcess" << std::endl;
|
std::cout << "Breaking out of EngineProcess" << std::endl;
|
||||||
@@ -840,6 +861,7 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
tempScale = 2;
|
tempScale = 2;
|
||||||
Client::Ref().SetPref("Scale", 2);
|
Client::Ref().SetPref("Scale", 2);
|
||||||
|
showDoubleScreenDialog = true;
|
||||||
}
|
}
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
LoadWindowPosition(tempScale);
|
LoadWindowPosition(tempScale);
|
||||||
|
Reference in New Issue
Block a user