mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge 565ed5e786
into d58673105d
This commit is contained in:
commit
7566ffb7a7
|
@ -29,6 +29,7 @@
|
|||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/Version.h>
|
||||
#include <openrct2/audio/AudioContext.h>
|
||||
#include <openrct2/audio/AudioMixer.h>
|
||||
|
@ -118,6 +119,20 @@ public:
|
|||
{
|
||||
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)");
|
||||
}
|
||||
if (gConfigGeneral.RefreshDPIScaling)
|
||||
{
|
||||
float ddpi, hdpi, vdpi;
|
||||
if (!SDL_GetDisplayDPI(0, &ddpi, &hdpi, &vdpi))
|
||||
{
|
||||
// If DPI can be read, divide DPI by regular DPI (96.0f) and round to nearest 0.25
|
||||
gConfigGeneral.WindowScale = std::round(ddpi / 96.0f * 4.0) / 4.0;
|
||||
|
||||
LOG_VERBOSE("Changing DPI scaling to %f\n", gConfigGeneral.WindowScale);
|
||||
}
|
||||
gConfigGeneral.RefreshDPIScaling = false;
|
||||
auto configPath = env->GetFilePath(PATHID::CONFIG);
|
||||
ConfigSave(configPath.c_str());
|
||||
}
|
||||
_cursorRepository.LoadCursors();
|
||||
_shortcutManager.LoadUserBindings();
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ namespace Config
|
|||
model->DisableLightningEffect = reader->GetBoolean("disable_lightning_effect", false);
|
||||
model->SteamOverlayPause = reader->GetBoolean("steam_overlay_pause", true);
|
||||
model->WindowScale = reader->GetFloat("window_scale", Platform::GetDefaultScale());
|
||||
model->RefreshDPIScaling = reader->GetBoolean("refresh_dpi_scaling", true);
|
||||
model->ShowFPS = reader->GetBoolean("show_fps", false);
|
||||
#ifdef _DEBUG
|
||||
// Always have multi-threading disabled in debug builds, this makes things slower.
|
||||
|
@ -289,6 +290,7 @@ namespace Config
|
|||
writer->WriteBoolean("disable_lightning_effect", model->DisableLightningEffect);
|
||||
writer->WriteBoolean("steam_overlay_pause", model->SteamOverlayPause);
|
||||
writer->WriteFloat("window_scale", model->WindowScale);
|
||||
writer->WriteBoolean("refresh_dpi_scaling", model->RefreshDPIScaling);
|
||||
writer->WriteBoolean("show_fps", model->ShowFPS);
|
||||
writer->WriteBoolean("multithreading", model->MultiThreading);
|
||||
writer->WriteBoolean("trap_cursor", model->TrapCursor);
|
||||
|
|
|
@ -32,6 +32,7 @@ struct GeneralConfiguration
|
|||
int32_t FullscreenWidth;
|
||||
int32_t FullscreenHeight;
|
||||
float WindowScale;
|
||||
bool RefreshDPIScaling;
|
||||
::DrawingEngine DrawingEngine;
|
||||
bool UncapFPS;
|
||||
bool UseVSync;
|
||||
|
|
Loading…
Reference in New Issue