mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- added window position and size restoration to SDL backend
This commit is contained in:
parent
663ac919bd
commit
3936e3018d
2 changed files with 59 additions and 16 deletions
|
@ -43,7 +43,6 @@
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "dikeys.h"
|
#include "dikeys.h"
|
||||||
#include "s_sound.h"
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
static void I_CheckGUICapture ();
|
static void I_CheckGUICapture ();
|
||||||
|
@ -57,7 +56,6 @@ extern int paused;
|
||||||
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
|
|
||||||
|
@ -305,20 +303,8 @@ void MessagePump (const SDL_Event &sev)
|
||||||
exit (0);
|
exit (0);
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
switch (sev.window.event)
|
extern void ProcessSDLWindowEvent(const SDL_WindowEvent &);
|
||||||
{
|
ProcessSDLWindowEvent(sev.window);
|
||||||
extern bool AppActive;
|
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
|
||||||
S_SetSoundPaused(1);
|
|
||||||
AppActive = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
|
||||||
S_SetSoundPaused(i_soundinbackground);
|
|
||||||
AppActive = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
#include "s_sound.h"
|
||||||
|
|
||||||
#include "videomodes.h"
|
#include "videomodes.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
@ -84,6 +85,13 @@ CUSTOM_CVAR(Bool, gl_es, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCA
|
||||||
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Int, win_y, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Int, win_w, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Int, win_h, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
|
CVAR(Bool, i_soundinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
@ -226,6 +234,20 @@ SystemFrameBuffer::SystemFrameBuffer (void *, bool fullscreen)
|
||||||
m_supportsGamma = -1 != SDL_GetWindowGammaRamp(Screen,
|
m_supportsGamma = -1 != SDL_GetWindowGammaRamp(Screen,
|
||||||
m_origGamma[0], m_origGamma[1], m_origGamma[2]
|
m_origGamma[0], m_origGamma[1], m_origGamma[2]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!fullscreen)
|
||||||
|
{
|
||||||
|
if (win_x >= 0 && win_y >= 0)
|
||||||
|
{
|
||||||
|
SDL_SetWindowPosition(Screen, win_x, win_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win_h > 320 && win_w > 200)
|
||||||
|
{
|
||||||
|
SDL_SetWindowSize(Screen, win_w, win_h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +350,41 @@ int SystemFrameBuffer::GetClientHeight()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProcessSDLWindowEvent(const SDL_WindowEvent &event)
|
||||||
|
{
|
||||||
|
switch (event.event)
|
||||||
|
{
|
||||||
|
extern bool AppActive;
|
||||||
|
|
||||||
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
|
S_SetSoundPaused(1);
|
||||||
|
AppActive = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
|
S_SetSoundPaused(i_soundinbackground);
|
||||||
|
AppActive = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
|
if (!fullscreen)
|
||||||
|
{
|
||||||
|
win_x = event.data1;
|
||||||
|
win_y = event.data2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
|
if (!fullscreen)
|
||||||
|
{
|
||||||
|
win_w = event.data1;
|
||||||
|
win_h = event.data2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// each platform has its own specific version of this function.
|
// each platform has its own specific version of this function.
|
||||||
void I_SetWindowTitle(const char* caption)
|
void I_SetWindowTitle(const char* caption)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue