- consolidate minimum screen resolution so that it's easier to change

This commit is contained in:
Rachael Alexanderson 2019-04-07 06:49:54 -04:00
parent e6dab46b90
commit efa9284141
7 changed files with 20 additions and 21 deletions

View file

@ -80,8 +80,6 @@ protected:
int GetTitleBarHeight() const; int GetTitleBarHeight() const;
static const int MINIMUM_WIDTH = 640;
static const int MINIMUM_HEIGHT = 400;
}; };
class SystemGLFrameBuffer : public SystemBaseFrameBuffer class SystemGLFrameBuffer : public SystemBaseFrameBuffer

View file

@ -40,6 +40,7 @@
#include "i_common.h" #include "i_common.h"
#include "v_video.h"
#include "bitmap.h" #include "bitmap.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "doomstat.h" #include "doomstat.h"
@ -482,7 +483,7 @@ void SystemBaseFrameBuffer::ToggleFullscreen(bool yes)
void SystemBaseFrameBuffer::SetWindowSize(int width, int height) void SystemBaseFrameBuffer::SetWindowSize(int width, int height)
{ {
if (width < MINIMUM_WIDTH || height < MINIMUM_HEIGHT) if (width < VID_MIN_WIDTH || height < VID_MIN_HEIGHT)
{ {
return; return;
} }
@ -549,8 +550,8 @@ void SystemBaseFrameBuffer::SetWindowedMode()
[m_window setHidesOnDeactivate:NO]; [m_window setHidesOnDeactivate:NO];
} }
const int minimumFrameWidth = MINIMUM_WIDTH; const int minimumFrameWidth = VID_MIN_WIDTH;
const int minimumFrameHeight = MINIMUM_HEIGHT + GetTitleBarHeight(); const int minimumFrameHeight = VID_MIN_HEIGHT + GetTitleBarHeight();
const NSSize minimumFrameSize = NSMakeSize(minimumFrameWidth, minimumFrameHeight); const NSSize minimumFrameSize = NSMakeSize(minimumFrameWidth, minimumFrameHeight);
[m_window setMinSize:minimumFrameSize]; [m_window setMinSize:minimumFrameSize];

View file

@ -111,9 +111,6 @@ namespace Priv
static const uint32_t VulkanWindowFlag = 0x1000'0000; static const uint32_t VulkanWindowFlag = 0x1000'0000;
static const int MIN_WIDTH = 320;
static const int MIN_HEIGHT = 200;
SDL_Window *window; SDL_Window *window;
bool vulkanEnabled; bool vulkanEnabled;
bool fullscreenSwitch; bool fullscreenSwitch;
@ -144,7 +141,7 @@ namespace Priv
if (Priv::window != nullptr) if (Priv::window != nullptr)
{ {
// Enforce minimum size limit // Enforce minimum size limit
SDL_SetWindowMinimumSize(Priv::window, Priv::MIN_WIDTH, Priv::MIN_HEIGHT); SDL_SetWindowMinimumSize(Priv::window, VID_MIN_WIDTH, VID_MIN_HEIGHT);
} }
} }

View file

@ -32,16 +32,16 @@
extern bool setsizeneeded; extern bool setsizeneeded;
EXTERN_CVAR(Int, vid_aspect) 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) if (self < VID_MIN_WIDTH)
self = 640; self = VID_MIN_WIDTH;
setsizeneeded = true; 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) if (self < VID_MIN_HEIGHT)
self = 400; self = VID_MIN_HEIGHT;
setsizeneeded = true; setsizeneeded = true;
} }
CVAR(Bool, vid_scale_customlinear, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, vid_scale_customlinear, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -116,7 +116,7 @@ int ViewportScaledWidth(int width, int height)
vid_scalemode = 0; vid_scalemode = 0;
if (vid_cropaspect && height > 0) if (vid_cropaspect && height > 0)
width = ((float)width/height > ActiveRatio(width, height)) ? (int)(height * ActiveRatio(width, height)) : width; 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) int ViewportScaledHeight(int width, int height)
@ -125,7 +125,7 @@ int ViewportScaledHeight(int width, int height)
vid_scalemode = 0; vid_scalemode = 0;
if (vid_cropaspect && height > 0) if (vid_cropaspect && height > 0)
height = ((float)width/height < ActiveRatio(width, height)) ? (int)(width / ActiveRatio(width, height)) : height; 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() bool ViewportIsScaled43()

View file

@ -216,8 +216,8 @@ void DFrameBuffer::Update()
int initialHeight = GetClientHeight(); int initialHeight = GetClientHeight();
int clientWidth = ViewportScaledWidth(initialWidth, initialHeight); int clientWidth = ViewportScaledWidth(initialWidth, initialHeight);
int clientHeight = ViewportScaledHeight(initialWidth, initialHeight); int clientHeight = ViewportScaledHeight(initialWidth, initialHeight);
if (clientWidth < 640) clientWidth = 640; if (clientWidth < VID_MIN_WIDTH) clientWidth = VID_MIN_WIDTH;
if (clientHeight < 400) clientHeight = 400; if (clientHeight < VID_MIN_HEIGHT) clientHeight = VID_MIN_HEIGHT;
if (clientWidth > 0 && clientHeight > 0 && (GetWidth() != clientWidth || GetHeight() != clientHeight)) if (clientWidth > 0 && clientHeight > 0 && (GetWidth() != clientWidth || GetHeight() != clientHeight))
{ {
SetVirtualSize(clientWidth, clientHeight); SetVirtualSize(clientWidth, clientHeight);

View file

@ -46,6 +46,9 @@
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "hwrenderer/dynlights/hw_shadowmap.h" #include "hwrenderer/dynlights/hw_shadowmap.h"
static const int VID_MIN_WIDTH = 640;
static const int VID_MIN_HEIGHT = 400;
struct sector_t; struct sector_t;
class FTexture; class FTexture;
struct FPortalSceneState; struct FPortalSceneState;

View file

@ -525,8 +525,8 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
else else
{ {
mmi->ptMinTrackSize.x = 640; mmi->ptMinTrackSize.x = VID_MIN_WIDTH;
mmi->ptMinTrackSize.y = 400; mmi->ptMinTrackSize.y = VID_MIN_HEIGHT;
} }
return 0; return 0;
} }