|
|
@ -20,21 +20,21 @@ GNU General Public License for more details. |
|
|
|
#include "vid_common.h" |
|
|
|
#include "vid_common.h" |
|
|
|
#include "platform/platform.h" |
|
|
|
#include "platform/platform.h" |
|
|
|
|
|
|
|
|
|
|
|
#define WINDOW_NAME XASH_ENGINE_NAME " Window" // Half-Life
|
|
|
|
static CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" ); |
|
|
|
convar_t *vid_fullscreen; |
|
|
|
static CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" ); |
|
|
|
convar_t *vid_mode; |
|
|
|
static CVAR_DEFINE( vid_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" ); |
|
|
|
convar_t *vid_brightness; |
|
|
|
static CVAR_DEFINE( vid_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" ); |
|
|
|
convar_t *vid_gamma; |
|
|
|
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" ); |
|
|
|
convar_t *vid_highdpi; |
|
|
|
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" ); |
|
|
|
|
|
|
|
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" ); |
|
|
|
|
|
|
|
CVAR_DEFINE( vid_fullscreen, "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" ); |
|
|
|
|
|
|
|
CVAR_DEFINE( window_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" ); |
|
|
|
|
|
|
|
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" ); |
|
|
|
|
|
|
|
|
|
|
|
glwstate_t glw_state; |
|
|
|
glwstate_t glw_state; |
|
|
|
|
|
|
|
|
|
|
|
convar_t *window_xpos; |
|
|
|
|
|
|
|
convar_t *window_ypos; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
convar_t *vid_rotate; |
|
|
|
|
|
|
|
convar_t *vid_scale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
================= |
|
|
|
================= |
|
|
|
VID_StartupGamma |
|
|
|
VID_StartupGamma |
|
|
@ -42,10 +42,10 @@ VID_StartupGamma |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void VID_StartupGamma( void ) |
|
|
|
void VID_StartupGamma( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BuildGammaTable( vid_gamma->value, vid_brightness->value ); |
|
|
|
BuildGammaTable( vid_gamma.value, vid_brightness.value ); |
|
|
|
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma->value, vid_brightness->value ); |
|
|
|
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma.value, vid_brightness.value ); |
|
|
|
ClearBits( vid_brightness->flags, FCVAR_CHANGED ); |
|
|
|
ClearBits( vid_brightness.flags, FCVAR_CHANGED ); |
|
|
|
ClearBits( vid_gamma->flags, FCVAR_CHANGED ); |
|
|
|
ClearBits( vid_gamma.flags, FCVAR_CHANGED ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -145,6 +145,36 @@ void VID_CheckChanges( void ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
=============== |
|
|
|
|
|
|
|
VID_SetDisplayTransform |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notify ref dll about screen transformations |
|
|
|
|
|
|
|
=============== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void VID_SetDisplayTransform( int *render_w, int *render_h ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint rotate = vid_rotate.value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, vid_scale.value, vid_scale.value )) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( rotate & 1 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int swap = *render_w; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*render_w = *render_h; |
|
|
|
|
|
|
|
*render_h = swap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*render_h /= vid_scale.value; |
|
|
|
|
|
|
|
*render_w /= vid_scale.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_WARN "failed to setup screen transform\n" ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void VID_Mode_f( void ) |
|
|
|
static void VID_Mode_f( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int w, h; |
|
|
|
int w, h; |
|
|
@ -177,25 +207,24 @@ static void VID_Mode_f( void ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
R_ChangeDisplaySettings( w, h, Cvar_VariableInteger( "fullscreen" ) ); |
|
|
|
R_ChangeDisplaySettings( w, h, !!vid_fullscreen.value ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void VID_Init( void ) |
|
|
|
void VID_Init( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// system screen width and height (don't suppose for change from console at all)
|
|
|
|
// system screen width and height (don't suppose for change from console at all)
|
|
|
|
Cvar_Get( "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" ); |
|
|
|
Cvar_RegisterVariable( &window_width ); |
|
|
|
Cvar_Get( "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" ); |
|
|
|
Cvar_RegisterVariable( &window_height ); |
|
|
|
|
|
|
|
|
|
|
|
window_xpos = Cvar_Get( "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" ); |
|
|
|
Cvar_RegisterVariable( &vid_mode ); |
|
|
|
window_ypos = Cvar_Get( "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" ); |
|
|
|
Cvar_RegisterVariable( &vid_highdpi ); |
|
|
|
|
|
|
|
Cvar_RegisterVariable( &vid_rotate ); |
|
|
|
vid_gamma = Cvar_Get( "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" ); |
|
|
|
Cvar_RegisterVariable( &vid_scale ); |
|
|
|
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" ); |
|
|
|
Cvar_RegisterVariable( &vid_fullscreen ); |
|
|
|
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" ); |
|
|
|
Cvar_RegisterVariable( &vid_brightness ); |
|
|
|
vid_mode = Cvar_Get( "vid_mode", "0", FCVAR_RENDERINFO, "current video mode index (used just for storage)" ); |
|
|
|
Cvar_RegisterVariable( &vid_gamma ); |
|
|
|
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" ); |
|
|
|
Cvar_RegisterVariable( &window_xpos ); |
|
|
|
vid_rotate = Cvar_Get( "vid_rotate", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" ); |
|
|
|
Cvar_RegisterVariable( &window_ypos ); |
|
|
|
vid_scale = Cvar_Get( "vid_scale", "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a1ba: planned to be named vid_mode for compability
|
|
|
|
// a1ba: planned to be named vid_mode for compability
|
|
|
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
|
|
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
|
|
|