[quake3-commits] r1728 - in trunk: . code/renderer code/sdl code/sys
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Nov 3 15:29:44 EST 2009
Author: thilo
Date: 2009-11-03 15:29:43 -0500 (Tue, 03 Nov 2009)
New Revision: 1728
Modified:
trunk/README
trunk/code/renderer/tr_init.c
trunk/code/renderer/tr_local.h
trunk/code/sdl/sdl_glimp.c
trunk/code/sys/sys_unix.c
trunk/code/sys/sys_win32.c
Log:
- implement r_noborder, inspired by patch from ensiform (#4289)
- Add Sys_SetEnv for portable setting of environment variables
- Default ioquake3 to appear on the center of the screen if running in windowed mode.
Modified: trunk/README
===================================================================
--- trunk/README 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/README 2009-11-03 20:29:43 UTC (rev 1728)
@@ -192,6 +192,8 @@
intend to use this.
r_sdlDriver - read only, indicates the SDL driver
backend being used
+ r_noborder - Remove window decoration from window
+ managers, like borders and titlebar.
New commands
video [filename] - start video capture (use with demo command)
Modified: trunk/code/renderer/tr_init.c
===================================================================
--- trunk/code/renderer/tr_init.c 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/code/renderer/tr_init.c 2009-11-03 20:29:43 UTC (rev 1728)
@@ -135,6 +135,7 @@
cvar_t *r_lodCurveError;
cvar_t *r_fullscreen;
+cvar_t *r_noborder;
cvar_t *r_customwidth;
cvar_t *r_customheight;
@@ -909,6 +910,7 @@
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
+ r_noborder = Cvar_Get("r_noborder", "0", CVAR_ARCHIVE);
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/code/renderer/tr_local.h 2009-11-03 20:29:43 UTC (rev 1728)
@@ -1043,6 +1043,7 @@
extern cvar_t *r_mode; // video mode
extern cvar_t *r_fullscreen;
+extern cvar_t *r_noborder;
extern cvar_t *r_gamma;
extern cvar_t *r_displayRefresh; // optional display refresh option
extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities
Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/code/sdl/sdl_glimp.c 2009-11-03 20:29:43 UTC (rev 1728)
@@ -188,7 +188,7 @@
GLimp_SetMode
===============
*/
-static int GLimp_SetMode( int mode, qboolean fullscreen )
+static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
{
const char* glstring;
int sdlcolorbits;
@@ -249,7 +249,12 @@
glConfig.isFullscreen = qtrue;
}
else
+ {
+ if (noborder)
+ flags |= SDL_NOFRAME;
+
glConfig.isFullscreen = qfalse;
+ }
colorbits = r_colorbits->value;
if ((!colorbits) || (colorbits >= 32))
@@ -428,7 +433,7 @@
GLimp_StartDriverAndSetMode
===============
*/
-static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
+static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qboolean noborder)
{
rserr_t err;
@@ -455,9 +460,9 @@
r_fullscreen->modified = qfalse;
fullscreen = qfalse;
}
+
+ err = GLimp_SetMode(mode, fullscreen, noborder);
- err = GLimp_SetMode( mode, fullscreen );
-
switch ( err )
{
case RSERR_INVALID_FULLSCREEN:
@@ -666,16 +671,18 @@
r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
+ Sys_SetEnv("SDL_VIDEO_CENTERED", "1");
+
Sys_GLimpInit( );
// Create the window and set up the context
- if( GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) )
+ if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, r_noborder->integer))
goto success;
// Try again, this time in a platform specific "safe mode"
Sys_GLimpSafeInit( );
- if( GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) )
+ if(GLimp_StartDriverAndSetMode(r_mode->integer, r_fullscreen->integer, qfalse))
goto success;
// Finally, try the default screen resolution
@@ -684,7 +691,7 @@
ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d\n",
r_mode->integer, R_MODE_FALLBACK );
- if( GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) )
+ if(GLimp_StartDriverAndSetMode(R_MODE_FALLBACK, r_fullscreen->integer, qfalse))
goto success;
}
Modified: trunk/code/sys/sys_unix.c
===================================================================
--- trunk/code/sys/sys_unix.c 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/code/sys/sys_unix.c 2009-11-03 20:29:43 UTC (rev 1728)
@@ -583,3 +583,19 @@
signal( SIGIOT, Sys_SigHandler );
signal( SIGBUS, Sys_SigHandler );
}
+
+/*
+==============
+Sys_SetEnv
+
+set/unset environment variables (empty value removes it)
+==============
+*/
+
+void Sys_SetEnv(const char *name, const char *value)
+{
+ if(value && *value)
+ setenv(name, value, 1);
+ else
+ unsetenv(name);
+}
Modified: trunk/code/sys/sys_win32.c
===================================================================
--- trunk/code/sys/sys_win32.c 2009-11-03 19:23:51 UTC (rev 1727)
+++ trunk/code/sys/sys_win32.c 2009-11-03 20:29:43 UTC (rev 1728)
@@ -652,3 +652,16 @@
SDL_VIDEODRIVER_externallySet = qfalse;
#endif
}
+
+/*
+==============
+Sys_SetEnv
+
+set/unset environment variables (empty value removes it)
+==============
+*/
+
+void Sys_SetEnv(const char *name, const char *value)
+{
+ _putenv(va("%s=%s", name, value);
+}
More information about the quake3-commits
mailing list