HDPI Mode added... because 4K display users!

This commit is contained in:
Marco Cawthorne 2017-11-10 19:05:48 -06:00
parent 9ddf09029c
commit 1d76c69a66
3 changed files with 50 additions and 1 deletions

View file

@ -114,6 +114,7 @@ Menu_Configuration_Video
void Menu_Configuration_Video( void ) {
static int iScrollRes = 0;
static int iSelectedResolution = -1;
static int iVideoScale = -1;
static void Video_Apply( void ) {
if ( iSelectedResolution != -1 ) {
@ -149,6 +150,15 @@ void Menu_Configuration_Video( void ) {
}
}
// Get the current scale method
if ( iVideoScale == -1 ) {
if ( cvar( "vid_conautoscale" ) == 0 ) {
iVideoScale = 1;
} else {
iVideoScale = 0;
}
}
Object_Label( '196 148', _("VIDEO_RES"), '8 8' );
Object_Frame( '196 160', '164 300' );
@ -166,9 +176,21 @@ void Menu_Configuration_Video( void ) {
Menu_ResetClipArea();
static void Video_ScaleSwitch( void ) {
iVideoScale = 1 - iVideoScale;
if ( iVideoScale == 1 ) {
cvar_set( "vid_conautoscale", "0" );
cvar_set( "vid_conwidth", "0" );
cvar_set( "vid_conheight", "480" );
} else {
cvar_set( "vid_conautoscale", "1" );
}
}
Object_CvarToggle( '400 165', "Fullscreen", "vid_fullscreen" );
Object_CvarToggle( '400 185', "Triple Buffering", "vid_triplebuffer" );
Object_CvarToggle( '400 205', "Virtual Synchronisation", "vid_vsync" );
Object_FuncToggle( '400 225', "HDPI Mode", Video_ScaleSwitch, iVideoScale );
Object_Button( '32 148', BTN_OK, Video_Apply, fButtonAlpha[0] );
Object_Button( '32 180', BTN_CANCEL, Menu_Configuration_ButtonCancel, fButtonAlpha[1] );

View file

@ -263,7 +263,7 @@ void Object_CvarToggle( vector vPosition, string sLabel, string sCvar ) {
int iWidth = stringwidth( sLabel, FALSE );
vPosition += vMenuOffset;
if ( Menu_InputCheckMouse( vPosition, [ iWidth, 8 ] ) == TRUE ) {
if ( Menu_InputCheckMouse( vPosition, [ iWidth + 32, 8 ] ) == TRUE ) {
fAlpha = 1.0f;
if ( fMouseClick == TRUE ) {
if ( cvar( sCvar ) == 0 ) {
@ -282,6 +282,33 @@ void Object_CvarToggle( vector vPosition, string sLabel, string sCvar ) {
} else {
drawstring( vPosition, sprintf( "[X] %s", sLabel ), '8 8', autocvar_menu_fgcolor, fAlpha, 0 );
}
}
/*
=================
Object_FuncToggle
A nice way of toggling cvars.
=================
*/
void Object_FuncToggle( vector vPosition, string sLabel, void( void ) vFunc, int iValue ) {
float fAlpha = 0.8f;
int iWidth = stringwidth( sLabel, FALSE );
vPosition += vMenuOffset;
if ( Menu_InputCheckMouse( vPosition, [ iWidth + 32, 8 ] ) == TRUE ) {
fAlpha = 1.0f;
if ( fMouseClick == TRUE ) {
vFunc();
fMouseClick = FALSE;
}
}
drawfill( vPosition + '-2 -2', [ iWidth + 36, 12 ], '0 0 0', 0.8f );
if ( iValue == 0 ) {
drawstring( vPosition, sprintf( "[ ] %s", sLabel ), '8 8', autocvar_menu_fgcolor, fAlpha, 0 );
} else {
drawstring( vPosition, sprintf( "[X] %s", sLabel ), '8 8', autocvar_menu_fgcolor, fAlpha, 0 );
}
}

Binary file not shown.