diff options
author | Simon Howard | 2007-02-23 23:26:26 +0000 |
---|---|---|
committer | Simon Howard | 2007-02-23 23:26:26 +0000 |
commit | f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9 (patch) | |
tree | 9a9b04169bef2a791690e2adafbb84c726b5271d /src/i_video.c | |
parent | e6d0591bd0674b0c56da7ca92a3721fa48aa1464 (diff) | |
download | chocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.tar.gz chocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.tar.bz2 chocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.zip |
Add a configuration file value to allow the SDL video driver to be
explicitly specified.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 838
Diffstat (limited to 'src/i_video.c')
-rw-r--r-- | src/i_video.c | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/src/i_video.c b/src/i_video.c index 88370024..0e66154e 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -67,6 +67,10 @@ enum extern void M_QuitDOOM(); +// SDL video driver name + +char *video_driver = ""; + static SDL_Surface *screen; // palette @@ -1100,28 +1104,19 @@ static void CreateCursors(void) 1, 1, 0, 0); } -void I_InitGraphics(void) +static void SetSDLVideoDriver(void) { - SDL_Event dummy; - byte *doompal; - int flags = 0; - char *env; - - // Pass through the XSCREENSAVER_WINDOW environment variable to - // SDL_WINDOWID, to embed the SDL window into the Xscreensaver - // window. - - env = getenv("XSCREENSAVER_WINDOW"); + // Allow a default value for the SDL video driver to be specified + // in the configuration file. - if (env != NULL) + if (strcmp(video_driver, "") != 0) { - char winenv[30]; - int winid; - - sscanf(env, "0x%x", &winid); - sprintf(winenv, "SDL_WINDOWID=%i", winid); + char *env_string; - putenv(winenv); + env_string = malloc(strlen(video_driver) + 30); + sprintf(env_string, "SDL_VIDEODRIVER=%s", env_string); + putenv(env_string); + free(env_string); } #ifdef _WIN32 @@ -1152,8 +1147,34 @@ void I_InitGraphics(void) { putenv("SDL_VIDEODRIVER=directx"); } - #endif +} + +void I_InitGraphics(void) +{ + SDL_Event dummy; + byte *doompal; + int flags = 0; + char *env; + + // Pass through the XSCREENSAVER_WINDOW environment variable to + // SDL_WINDOWID, to embed the SDL window into the Xscreensaver + // window. + + env = getenv("XSCREENSAVER_WINDOW"); + + if (env != NULL) + { + char winenv[30]; + int winid; + + sscanf(env, "0x%x", &winid); + sprintf(winenv, "SDL_WINDOWID=%i", winid); + + putenv(winenv); + } + + SetSDLVideoDriver(); if (SDL_Init(SDL_INIT_VIDEO) < 0) { |