show confirm dialog for double screen mode in case of false detections
This commit is contained in:
parent
aa108be3df
commit
36e8f6d900
@ -5,3 +5,4 @@ void EngineProcess();
|
||||
void ClipboardPush(std::string text);
|
||||
std::string ClipboardPull();
|
||||
int GetModifiers();
|
||||
bool LoadWindowPosition(int scale);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user