Browse Source

engine: client: add definitions for borderless fullscreen mode

pull/2/head
Alibek Omarov 1 year ago
parent
commit
1e43cb734b
  1. 10
      engine/client/ref_common.c
  2. 4
      engine/client/vid_common.c
  3. 9
      engine/client/vid_common.h

10
engine/client/ref_common.c

@ -554,16 +554,12 @@ static void SetWidthAndHeightFromCommandLine( void )
static void SetFullscreenModeFromCommandLine( void ) static void SetFullscreenModeFromCommandLine( void )
{ {
#if !XASH_MOBILE_PLATFORM if( Sys_CheckParm( "-borderless" ))
if( Sys_CheckParm( "-fullscreen" )) Cvar_DirectSet( &vid_fullscreen, "2" );
{ else if( Sys_CheckParm( "-fullscreen" ))
Cvar_DirectSet( &vid_fullscreen, "1" ); Cvar_DirectSet( &vid_fullscreen, "1" );
}
else if( Sys_CheckParm( "-windowed" )) else if( Sys_CheckParm( "-windowed" ))
{
Cvar_DirectSet( &vid_fullscreen, "0" ); Cvar_DirectSet( &vid_fullscreen, "0" );
}
#endif
} }
static void R_CollectRendererNames( void ) static void R_CollectRendererNames( void )

4
engine/client/vid_common.c

@ -30,7 +30,7 @@ static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "p
CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" ); CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
CVAR_DEFINE_AUTO( vid_maximized, "0", FCVAR_RENDERINFO, "window maximized state, read-only" ); CVAR_DEFINE_AUTO( vid_maximized, "0", FCVAR_RENDERINFO, "window maximized state, read-only" );
CVAR_DEFINE( vid_fullscreen, "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscren mode" ); CVAR_DEFINE( vid_fullscreen, "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen state (0 windowed, 1 fullscreen, 2 borderless)" );
CVAR_DEFINE( window_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" ); 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" ); CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
@ -209,7 +209,7 @@ static void VID_Mode_f( void )
return; return;
} }
R_ChangeDisplaySettings( w, h, !!vid_fullscreen.value ); R_ChangeDisplaySettings( w, h, bound( 0, vid_fullscreen.value, WINDOW_MODE_COUNT - 1 ));
} }
void VID_Init( void ) void VID_Init( void )

9
engine/client/vid_common.h

@ -9,6 +9,13 @@ typedef struct vidmode_s
int height; int height;
} vidmode_t; } vidmode_t;
typedef enum window_mode_e
{
WINDOW_MODE_WINDOWED = 0,
WINDOW_MODE_FULLSCREEN,
WINDOW_MODE_BORDERLESS,
WINDOW_MODE_COUNT,
} window_mode_t;
typedef struct typedef struct
{ {
@ -21,8 +28,6 @@ typedef struct
qboolean initialized; // OpenGL subsystem started qboolean initialized; // OpenGL subsystem started
qboolean extended; // extended context allows to GL_Debug qboolean extended; // extended context allows to GL_Debug
qboolean software; qboolean software;
} glwstate_t; } glwstate_t;
extern glwstate_t glw_state; extern glwstate_t glw_state;

Loading…
Cancel
Save