GUI: auto-detect scale factor on settings change
This commit is contained in:
parent
f53bc88242
commit
0e19716dcd
|
|
@ -29,6 +29,7 @@
|
||||||
#include "IconsFontAwesome4.h"
|
#include "IconsFontAwesome4.h"
|
||||||
#include "furIcons.h"
|
#include "furIcons.h"
|
||||||
#include "misc/cpp/imgui_stdlib.h"
|
#include "misc/cpp/imgui_stdlib.h"
|
||||||
|
#include "scaling.h"
|
||||||
#include <fmt/printf.h>
|
#include <fmt/printf.h>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
|
|
@ -4063,7 +4064,20 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
||||||
setupLabel(settings.emptyLabel.c_str(),emptyLabel,3);
|
setupLabel(settings.emptyLabel.c_str(),emptyLabel,3);
|
||||||
setupLabel(settings.emptyLabel2.c_str(),emptyLabel2,2);
|
setupLabel(settings.emptyLabel2.c_str(),emptyLabel2,2);
|
||||||
|
|
||||||
if (settings.dpiScale>=0.5f) dpiScale=settings.dpiScale;
|
// get scale factor
|
||||||
|
const char* videoBackend=SDL_GetCurrentVideoDriver();
|
||||||
|
if (settings.dpiScale>=0.5f) {
|
||||||
|
logD("setting UI scale factor from config (%f).",settings.dpiScale);
|
||||||
|
dpiScale=settings.dpiScale;
|
||||||
|
} else {
|
||||||
|
logD("auto-detecting UI scale factor.");
|
||||||
|
dpiScale=getScaleFactor(videoBackend);
|
||||||
|
logD("scale factor: %f",dpiScale);
|
||||||
|
if (dpiScale<0.1f) {
|
||||||
|
logW("scale what?");
|
||||||
|
dpiScale=1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
if (updateFonts) {
|
if (updateFonts) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue