From f4ea44b76003c85ba4af586eaf37d51f7a90e49e Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 7 Apr 2019 06:49:54 -0400 Subject: [PATCH] - consolidate minimum screen resolution so that it's easier to change --- src/posix/cocoa/gl_sysfb.h | 2 -- src/posix/cocoa/i_video.mm | 7 ++++--- src/r_videoscale.cpp | 16 ++++++++-------- src/v_framebuffer.cpp | 4 ++-- src/v_video.h | 3 +++ src/win32/i_input.cpp | 4 ++-- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/posix/cocoa/gl_sysfb.h b/src/posix/cocoa/gl_sysfb.h index 2a2b8a5d2..664abee81 100644 --- a/src/posix/cocoa/gl_sysfb.h +++ b/src/posix/cocoa/gl_sysfb.h @@ -91,8 +91,6 @@ private: int GetTitleBarHeight() const; - static const int MINIMUM_WIDTH = 640; - static const int MINIMUM_HEIGHT = 400; }; #endif // COCOA_GL_SYSFB_H_INCLUDED diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index d18099ca1..58a929f9b 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -35,6 +35,7 @@ #include "i_common.h" +#include "v_video.h" #include "bitmap.h" #include "c_dispatch.h" #include "doomstat.h" @@ -345,7 +346,7 @@ void SystemGLFrameBuffer::ToggleFullscreen(bool yes) void SystemGLFrameBuffer::SetWindowSize(int width, int height) { - if (width < MINIMUM_WIDTH || height < MINIMUM_HEIGHT) + if (width < VID_MIN_WIDTH || height < VID_MIN_HEIGHT) { return; } @@ -426,8 +427,8 @@ void SystemGLFrameBuffer::SetWindowedMode() [m_window setHidesOnDeactivate:NO]; } - const int minimumFrameWidth = MINIMUM_WIDTH; - const int minimumFrameHeight = MINIMUM_HEIGHT + GetTitleBarHeight(); + const int minimumFrameWidth = VID_MIN_WIDTH; + const int minimumFrameHeight = VID_MIN_HEIGHT + GetTitleBarHeight(); const NSSize minimumFrameSize = NSMakeSize(minimumFrameWidth, minimumFrameHeight); [m_window setMinSize:minimumFrameSize]; diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index fbd7393c5..493fd122a 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -32,16 +32,16 @@ extern bool setsizeneeded; EXTERN_CVAR(Int, vid_aspect) -CUSTOM_CVAR(Int, vid_scale_customwidth, 640, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Int, vid_scale_customwidth, VID_MIN_WIDTH, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self < 640) - self = 640; + if (self < VID_MIN_WIDTH) + self = VID_MIN_WIDTH; setsizeneeded = true; } -CUSTOM_CVAR(Int, vid_scale_customheight, 400, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Int, vid_scale_customheight, VID_MIN_HEIGHT, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self < 400) - self = 400; + if (self < VID_MIN_HEIGHT) + self = VID_MIN_HEIGHT; setsizeneeded = true; } CVAR(Bool, vid_scale_customlinear, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) @@ -116,7 +116,7 @@ int ViewportScaledWidth(int width, int height) vid_scalemode = 0; if (vid_cropaspect && height > 0) width = ((float)width/height > ActiveRatio(width, height)) ? (int)(height * ActiveRatio(width, height)) : width; - return (int)MAX((int32_t)320, (int32_t)(vid_scalefactor * vScaleTable[vid_scalemode].GetScaledWidth(width))); + return (int)MAX((int32_t)VID_MIN_WIDTH, (int32_t)(vid_scalefactor * vScaleTable[vid_scalemode].GetScaledWidth(width))); } int ViewportScaledHeight(int width, int height) @@ -125,7 +125,7 @@ int ViewportScaledHeight(int width, int height) vid_scalemode = 0; if (vid_cropaspect && height > 0) height = ((float)width/height < ActiveRatio(width, height)) ? (int)(width / ActiveRatio(width, height)) : height; - return (int)MAX((int32_t)200, (int32_t)(vid_scalefactor * vScaleTable[vid_scalemode].GetScaledHeight(height))); + return (int)MAX((int32_t)VID_MIN_HEIGHT, (int32_t)(vid_scalefactor * vScaleTable[vid_scalemode].GetScaledHeight(height))); } bool ViewportIsScaled43() diff --git a/src/v_framebuffer.cpp b/src/v_framebuffer.cpp index 3a569cb1d..24cbb1914 100644 --- a/src/v_framebuffer.cpp +++ b/src/v_framebuffer.cpp @@ -210,8 +210,8 @@ void DFrameBuffer::Update() int initialHeight = GetClientHeight(); int clientWidth = ViewportScaledWidth(initialWidth, initialHeight); int clientHeight = ViewportScaledHeight(initialWidth, initialHeight); - if (clientWidth < 640) clientWidth = 640; - if (clientHeight < 400) clientHeight = 400; + if (clientWidth < VID_MIN_WIDTH) clientWidth = VID_MIN_WIDTH; + if (clientHeight < VID_MIN_HEIGHT) clientHeight = VID_MIN_HEIGHT; if (clientWidth > 0 && clientHeight > 0 && (GetWidth() != clientWidth || GetHeight() != clientHeight)) { SetVirtualSize(clientWidth, clientHeight); diff --git a/src/v_video.h b/src/v_video.h index 7f35f3322..39089388c 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -46,6 +46,9 @@ #include "v_2ddrawer.h" #include "hwrenderer/dynlights/hw_shadowmap.h" +static const int VID_MIN_WIDTH = 640; +static const int VID_MIN_HEIGHT = 400; + struct sector_t; class IShaderProgram; class FTexture; diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index b8f5ba777..74791cc5c 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -525,8 +525,8 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } else { - mmi->ptMinTrackSize.x = 640; - mmi->ptMinTrackSize.y = 400; + mmi->ptMinTrackSize.x = VID_MIN_WIDTH; + mmi->ptMinTrackSize.y = VID_MIN_HEIGHT; } return 0; }