mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-16 17:21:21 +00:00
Add r_windowResizable to configure if window is resizable
incl. setting in SettingsMenu With SDL 2.0.5 and newer this change is applied immediately, 2.0.0 to 2.0.4 need a vid_restart (with SDL1.2 we don't support it at all)
This commit is contained in:
parent
a6870cabfc
commit
ac8eec932b
8 changed files with 34 additions and 2 deletions
|
@ -26,6 +26,8 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num
|
|||
volume when too many too loud sounds play at once, to avoid issues like clipping
|
||||
* `s_scaleDownAndClamp`: Clamp and reduce volume of all sounds to prevent clipping or temporary
|
||||
downscaling by OpenAL's output limiter
|
||||
* If `r_windowResizable` is set, the dhewm3 window (when in windowed mode..) can be freely resized.
|
||||
Needs SDL2; with 2.0.5 and newer it's applied immediately, otherwise when creating the window.
|
||||
|
||||
|
||||
1.5.3 (2024-03-29)
|
||||
|
|
|
@ -203,6 +203,9 @@ This can be configured with the following CVars:
|
|||
- `r_fullscreenDesktop` configures fullscreen windows (when `r_fullscreen` is `1`).
|
||||
`0`: "real"/"exclusive" fullscreen mode, might switch screen resolution
|
||||
`1`: "desktop" fullscreen mode, which keeps desktop resolution and is more like a borderless fullscreen window
|
||||
- `r_windowResizable` if set to `1` (the default), the dhewm3 window (when in windowed mode..)
|
||||
can be freely resized. Needs SDL2; with 2.0.5 and newer it's applied immediately, otherwise when
|
||||
creating the window (startup or `vid_restart`).
|
||||
- `r_fillWindowAlphaChan` Make sure alpha channel of windows default framebuffer is completely opaque
|
||||
at the end of each frame. Needed at least when using Wayland.
|
||||
`1`: do this, `0`: don't do it, `-1`: let dhewm3 decide (default)
|
||||
|
|
|
@ -1651,6 +1651,7 @@ static CVarOption videoOptionsImmediately[] = {
|
|||
}
|
||||
AddCVarOptionTooltips( cvar, descr );
|
||||
} ),
|
||||
CVarOption( "r_windowResizable", "Make dhewm3 window resizable", OT_BOOL ),
|
||||
CVarOption( "r_brightness", "Brightness", OT_FLOAT, 0.5f, 2.0f ),
|
||||
CVarOption( "r_gamma", "Gamma", OT_FLOAT, 0.5f, 3.0f ),
|
||||
CVarOption( "r_gammaInShader", "Apply gamma and brightness in shaders", OT_BOOL ),
|
||||
|
|
|
@ -265,6 +265,11 @@ static void R_CheckCvars( void ) {
|
|||
GLimp_SetSwapInterval( r_swapInterval.GetInteger() );
|
||||
r_swapInterval.ClearModified();
|
||||
}
|
||||
|
||||
if ( r_windowResizable.IsModified() ) {
|
||||
GLimp_SetWindowResizable( r_windowResizable.GetBool() );
|
||||
r_windowResizable.ClearModified();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -235,6 +235,8 @@ idCVar r_useStencilOpSeparate( "r_useStencilOpSeparate", "1", CVAR_RENDERER | CV
|
|||
idCVar r_screenshotFormat("r_screenshotFormat", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "Screenshot format. 0 = TGA (default), 1 = BMP, 2 = PNG, 3 = JPG");
|
||||
idCVar r_screenshotJpgQuality("r_screenshotJpgQuality", "75", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "Screenshot quality for JPG images (1-100). Lower value means smaller file but worse quality");
|
||||
idCVar r_screenshotPngCompression("r_screenshotPngCompression", "3", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "Compression level when using PNG screenshots (0-9). Higher levels generate smaller files, but take noticeably longer");
|
||||
// DG: allow freely resizing the window
|
||||
idCVar r_windowResizable("r_windowResizable", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Allow resizing (and maximizing) the window (needs SDL2; with 2.0.5 or newer it's applied immediately)" );
|
||||
|
||||
// define qgl functions
|
||||
#define QGLPROC(name, rettype, args) rettype (APIENTRYP q##name) args;
|
||||
|
|
|
@ -818,6 +818,7 @@ extern idCVar r_displayRefresh; // optional display refresh rate option for vi
|
|||
extern idCVar r_fullscreen; // 0 = windowed, 1 = full screen
|
||||
extern idCVar r_fullscreenDesktop; // 0: 'real' fullscreen mode 1: keep resolution 'desktop' fullscreen mode
|
||||
extern idCVar r_multiSamples; // number of antialiasing samples
|
||||
extern idCVar r_windowResizable; // DG: allow resizing and maximizing the window
|
||||
|
||||
extern idCVar r_ignore; // used for random debugging without defining new vars
|
||||
extern idCVar r_ignore2; // used for random debugging without defining new vars
|
||||
|
@ -1115,7 +1116,7 @@ const int GRAB_RELATIVEMOUSE = (1 << 2);
|
|||
void GLimp_GrabInput(int flags);
|
||||
|
||||
bool GLimp_SetSwapInterval( int swapInterval );
|
||||
|
||||
bool GLimp_SetWindowResizable( bool enableResizable );
|
||||
void GLimp_UpdateWindowSize();
|
||||
|
||||
/*
|
||||
|
|
|
@ -164,9 +164,13 @@ bool GLimp_Init(glimpParms_t parms) {
|
|||
flags |= SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
|
||||
r_windowResizable.ClearModified();
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
flags |= SDL_WINDOW_RESIZABLE;
|
||||
|
||||
if ( r_windowResizable.GetBool() ) {
|
||||
flags |= SDL_WINDOW_RESIZABLE;
|
||||
}
|
||||
|
||||
/* Doom3 has the nasty habit of modifying the default framebuffer's alpha channel and then
|
||||
* relying on those modifications in blending operations (using GL_DST_(ONE_MINUS_)ALPHA).
|
||||
|
@ -768,11 +772,24 @@ bool GLimp_SetSwapInterval( int swapInterval )
|
|||
#endif
|
||||
}
|
||||
|
||||
bool GLimp_SetWindowResizable( bool enableResizable )
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 5)
|
||||
SDL_SetWindowResizable( window, (SDL_bool)enableResizable );
|
||||
return true;
|
||||
#else
|
||||
common->Warning( "dhewm3 must be built with SDL 2.0.5 or newer to change resizability of existing windows!" );
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLimp_UpdateWindowSize()
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
int ww=0, wh=0;
|
||||
SDL_GetWindowSize( window, &ww, &wh );
|
||||
glConfig.winWidth = ww;
|
||||
glConfig.winHeight = wh;
|
||||
SDL_GL_GetDrawableSize( window, &glConfig.vidWidth, &glConfig.vidHeight );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -399,6 +399,7 @@ void GLimp_DeactivateContext() {};
|
|||
void GLimp_GrabInput(int flags) {};
|
||||
bool GLimp_SetSwapInterval( int swapInterval ) { return false; }
|
||||
void GLimp_UpdateWindowSize() {}
|
||||
bool GLimp_SetWindowResizable( bool enableResizable ) { return false; }
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
|
Loading…
Reference in a new issue