diff --git a/engine/core/core_video.cpp b/engine/core/core_video.cpp index d65b5aa..de6abd2 100644 --- a/engine/core/core_video.cpp +++ b/engine/core/core_video.cpp @@ -49,6 +49,7 @@ class core_video_c: public core_IVideo, public conCmdHandler_c { conVar_c* vid_fullscreen; conVar_c* vid_resizable; conVar_c* vid_last; + conVar_c* vid_dpiScale; void C_Vid_Apply(IConsole* conHnd, args_c &args); void C_Vid_ModeList(IConsole* conHnd, args_c &args); @@ -71,6 +72,7 @@ core_video_c::core_video_c(sys_IMain* sysHnd) vid_fullscreen = sys->con->Cvar_Add("vid_fullscreen", CV_ARCHIVE, CFG_VID_DEFFULLSCREEN); vid_resizable = sys->con->Cvar_Add("vid_resizable", CV_ARCHIVE|CV_CLAMP, CFG_VID_DEFRESIZABLE, 0, 3); vid_last = sys->con->Cvar_Add("vid_last", CV_ARCHIVE, ""); + vid_dpiScale = sys->con->Cvar_Add("vid_dpiScale", CV_ARCHIVE, "0"); Cmd_Add("vid_apply", 0, "", this, &core_video_c::C_Vid_Apply); Cmd_Add("vid_modeList", 0, "", this, &core_video_c::C_Vid_ModeList); @@ -108,6 +110,9 @@ void core_video_c::Apply(bool shown) set.mode[0] = 0; set.mode[1] = 0; } + if (vid_dpiScale->floatVal > 0.0f) { + set.dpiScale = vid_dpiScale->floatVal; + } set.minSize[0] = CFG_VID_MINWIDTH; set.minSize[1] = CFG_VID_MINHEIGHT; sys->video->Apply(&set); diff --git a/engine/system/sys_video.h b/engine/system/sys_video.h index 0d7600a..d7e0b01 100644 --- a/engine/system/sys_video.h +++ b/engine/system/sys_video.h @@ -30,6 +30,7 @@ struct sys_vidSet_s { int flags = 0; // Flags int mode[2] = {}; // Window size int minSize[2] = {}; // Minimum size for resizable windows + float dpiScale = 0.0f; // Override DPI scale sys_vidSave_s save; // Saved state }; diff --git a/engine/system/win/sys_video.cpp b/engine/system/win/sys_video.cpp index 7e58457..560e0b8 100644 --- a/engine/system/win/sys_video.cpp +++ b/engine/system/win/sys_video.cpp @@ -442,6 +442,10 @@ int sys_video_c::Apply(sys_vidSet_s* set) } else { ignoreDpiScale = ShouldIgnoreDpiScale(); + if (cur.dpiScale > 0.0f) { + ignoreDpiScale = true; + sys->video->vid.dpiScale = cur.dpiScale; + } glfwWindowHint(GLFW_RESIZABLE, !!(cur.flags & VID_RESIZABLE)); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Start hidden to not flash the user with a stock window. glfwWindowHint(GLFW_MAXIMIZED, GLFW_FALSE); // Start restored in order to position the window before maximizing.