Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions engine/core/core_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions engine/system/sys_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
4 changes: 4 additions & 0 deletions engine/system/win/sys_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,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.
Expand Down