mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-30 00:10:53 +00:00
Fix fullscreen switch on Alt-Enter
Switching to fullscreen through a SDL2 call is nice, but the renderer needs to be reinitialized. Without it some things will break, for example the gamma setting.
This commit is contained in:
parent
06834d1fb5
commit
02156e03ec
3 changed files with 21 additions and 32 deletions
|
@ -510,7 +510,13 @@ GLimp_InitGraphics(qboolean fullscreen)
|
|||
/* If we want fullscreen, but aren't */
|
||||
if (fullscreen != IsFullscreen())
|
||||
{
|
||||
GLimp_ToggleFullscreen();
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_SetWindowFullscreen(window, fullscreen ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
#else
|
||||
SDL_WM_ToggleFullScreen(window);
|
||||
#endif
|
||||
|
||||
Cvar_SetValue("vid_fullscreen", fullscreen);
|
||||
}
|
||||
|
||||
/* Are we now? */
|
||||
|
@ -705,31 +711,6 @@ GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen)
|
|||
return rserr_ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle fullscreen.
|
||||
*/
|
||||
void GLimp_ToggleFullscreen(void)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
int wantFullscreen = !IsFullscreen();
|
||||
|
||||
SDL_SetWindowFullscreen(window, wantFullscreen ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
Cvar_SetValue("vid_fullscreen", wantFullscreen);
|
||||
#else
|
||||
SDL_WM_ToggleFullScreen(window);
|
||||
|
||||
if (IsFullscreen())
|
||||
{
|
||||
Cvar_SetValue("vid_fullscreen", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_SetValue("vid_fullscreen", 0);
|
||||
}
|
||||
#endif
|
||||
vid_fullscreen->modified = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (Un)grab Input
|
||||
*/
|
||||
|
|
|
@ -909,6 +909,7 @@ Key_Event(int key, qboolean down, qboolean special)
|
|||
{
|
||||
char cmd[1024];
|
||||
char *kb;
|
||||
cvar_t *fullscreen;
|
||||
unsigned int time = Sys_Milliseconds();
|
||||
|
||||
/* Track if key is down */
|
||||
|
@ -938,7 +939,19 @@ Key_Event(int key, qboolean down, qboolean special)
|
|||
/* Fullscreen switch through Alt + Return */
|
||||
if (down && keydown[K_ALT] && key == K_ENTER)
|
||||
{
|
||||
GLimp_ToggleFullscreen();
|
||||
fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||
|
||||
if (!fullscreen->value)
|
||||
{
|
||||
fullscreen->value = 1;
|
||||
fullscreen->modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullscreen->value = 0;
|
||||
fullscreen->modified = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -429,11 +429,6 @@ int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen);
|
|||
*/
|
||||
void *GLimp_GetProcAddress (const char* proc);
|
||||
|
||||
/*
|
||||
* Toggle fullscreen.
|
||||
*/
|
||||
void GLimp_ToggleFullscreen(void);
|
||||
|
||||
/*
|
||||
* (Un)grab Input
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue