2002-08-21 00:05:27 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2005-08-04 15:27:09 +00:00
|
|
|
static __attribute__ ((used)) const char rcsid[] =
|
2003-01-15 15:31:36 +00:00
|
|
|
"$Id$";
|
|
|
|
|
2002-08-21 00:05:27 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include "QF/cvar.h"
|
2003-02-13 19:03:48 +00:00
|
|
|
#include "QF/input.h"
|
2007-11-06 10:17:14 +00:00
|
|
|
#include "QF/sys.h"
|
2002-08-21 00:05:27 +00:00
|
|
|
#include "QF/va.h"
|
|
|
|
#include "QF/vid.h"
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
#include "context_sdl.h"
|
2012-02-17 07:13:56 +00:00
|
|
|
#include "vid_internal.h"
|
2003-01-06 18:28:13 +00:00
|
|
|
|
2002-08-26 22:43:34 +00:00
|
|
|
cvar_t *vid_bitdepth;
|
|
|
|
|
2002-08-21 00:05:27 +00:00
|
|
|
extern SDL_Surface *screen;
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
VID_SDL_GammaCheck (void)
|
|
|
|
{
|
|
|
|
Uint16 redtable[256], greentable[256], bluetable[256];
|
|
|
|
|
|
|
|
if (SDL_GetGammaRamp(redtable, greentable, bluetable) < 0)
|
|
|
|
vid_gamma_avail = false;
|
|
|
|
else
|
|
|
|
vid_gamma_avail = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VID_SetCaption (const char *text)
|
|
|
|
{
|
|
|
|
if (text && *text) {
|
|
|
|
char *temp = strdup (text);
|
|
|
|
|
2010-08-19 06:01:43 +00:00
|
|
|
SDL_WM_SetCaption (va ("%s: %s", PACKAGE_STRING, temp), NULL);
|
2002-08-21 00:05:27 +00:00
|
|
|
free (temp);
|
|
|
|
} else {
|
2010-08-19 06:01:43 +00:00
|
|
|
SDL_WM_SetCaption (va ("%s", PACKAGE_STRING), NULL);
|
2002-08-21 00:05:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qboolean
|
|
|
|
VID_SetGamma (double gamma)
|
|
|
|
{
|
|
|
|
return SDL_SetGamma((float) gamma, (float) gamma, (float) gamma);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VID_Shutdown (void)
|
|
|
|
{
|
|
|
|
SDL_Quit ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-08-21 00:05:27 +00:00
|
|
|
VID_UpdateFullscreen (cvar_t *vid_fullscreen)
|
|
|
|
{
|
2012-02-14 10:47:02 +00:00
|
|
|
if (!viddef.initialized)
|
2002-08-21 00:05:27 +00:00
|
|
|
return;
|
|
|
|
if ((vid_fullscreen->int_val && !(screen->flags & SDL_FULLSCREEN))
|
|
|
|
|| (!vid_fullscreen->int_val && screen->flags & SDL_FULLSCREEN))
|
|
|
|
if (!SDL_WM_ToggleFullScreen (screen))
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("VID_UpdateFullscreen: error setting fullscreen\n");
|
2003-02-25 06:04:42 +00:00
|
|
|
IN_UpdateGrab (in_grab);
|
2002-08-21 00:05:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-04-12 07:47:37 +00:00
|
|
|
SDL_Init_Cvars (void)
|
2002-08-21 00:05:27 +00:00
|
|
|
{
|
|
|
|
vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ARCHIVE,
|
|
|
|
VID_UpdateFullscreen,
|
|
|
|
"Toggles fullscreen mode");
|
|
|
|
vid_system_gamma = Cvar_Get ("vid_system_gamma", "1", CVAR_ARCHIVE, NULL,
|
|
|
|
"Use system gamma control if available");
|
2003-03-03 19:32:56 +00:00
|
|
|
// FIXME: vid_colorbpp in common GL setup, make consistent with sdl32 scheme
|
2002-08-26 22:43:34 +00:00
|
|
|
vid_bitdepth = Cvar_Get ("vid_bitdepth", "8", CVAR_ROM, NULL, "Sets "
|
|
|
|
"display bitdepth (supported modes: 8 16 32)");
|
2002-08-21 00:05:27 +00:00
|
|
|
}
|