2002-08-21 00:05:27 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
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-21 00:05:27 +00:00
|
|
|
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);
|
|
|
|
|
2021-01-31 07:01:20 +00:00
|
|
|
SDL_WM_SetCaption (va (0, "%s: %s", PACKAGE_STRING, temp), NULL);
|
2002-08-21 00:05:27 +00:00
|
|
|
free (temp);
|
|
|
|
} else {
|
2021-01-31 07:01:20 +00:00
|
|
|
SDL_WM_SetCaption (va (0, "%s", PACKAGE_STRING), NULL);
|
2002-08-21 00:05:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qboolean
|
|
|
|
VID_SetGamma (double gamma)
|
|
|
|
{
|
2012-05-21 23:23:22 +00:00
|
|
|
return SDL_SetGamma((float) gamma, (float) gamma, (float) gamma);
|
2002-08-21 00:05:27 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-08-21 00:05:27 +00:00
|
|
|
VID_UpdateFullscreen (cvar_t *vid_fullscreen)
|
|
|
|
{
|
2013-01-16 02:23:47 +00:00
|
|
|
if (!r_data || !viddef.initialized)
|
2002-08-21 00:05:27 +00:00
|
|
|
return;
|
2019-07-08 16:00:47 +00:00
|
|
|
if ((vid_fullscreen->int_val && !(sdl_screen->flags & SDL_FULLSCREEN))
|
|
|
|
|| (!vid_fullscreen->int_val && sdl_screen->flags & SDL_FULLSCREEN))
|
|
|
|
if (!SDL_WM_ToggleFullScreen (sdl_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");
|
|
|
|
}
|