mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- skip rendering when application is not active
Use vid_activeinbackground CVAR to override this behavior
This commit is contained in:
parent
311259b0f5
commit
2be84dc636
11 changed files with 25 additions and 45 deletions
|
@ -28,13 +28,6 @@
|
|||
|
||||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define mkdir(a,b) _mkdir (a)
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FPU_CONTROL
|
||||
#include <fpu_control.h>
|
||||
#endif
|
||||
|
@ -237,6 +230,7 @@ FStartupInfo DoomStartupInfo;
|
|||
FString lastIWAD;
|
||||
int restart = 0;
|
||||
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
|
||||
bool AppActive = true;
|
||||
|
||||
cycle_t FrameCycles;
|
||||
|
||||
|
@ -645,6 +639,8 @@ CVAR (Flag, compat_multiexit, compatflags2, COMPATF2_MULTIEXIT);
|
|||
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
|
||||
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
|
||||
|
||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D_Display
|
||||
|
@ -660,6 +656,11 @@ void D_Display ()
|
|||
if (nodrawers || screen == NULL)
|
||||
return; // for comparative timing / profiling
|
||||
|
||||
if (!AppActive && (screen->IsFullscreen() || !vid_activeinbackground))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cycle_t cycles;
|
||||
|
||||
cycles.Reset();
|
||||
|
|
|
@ -148,12 +148,6 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
|
||||
void OpenGLFrameBuffer::Update()
|
||||
{
|
||||
if (!CanUpdate())
|
||||
{
|
||||
GLRenderer->Flush();
|
||||
return;
|
||||
}
|
||||
|
||||
DrawRateStuff();
|
||||
GLRenderer->Flush();
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
|||
|
||||
void InitializeState();
|
||||
|
||||
bool CanUpdate();
|
||||
void SwapBuffers();
|
||||
|
||||
void SetGammaTable(uint16_t* table);
|
||||
|
|
|
@ -296,18 +296,24 @@ ApplicationController* appCtrl;
|
|||
}
|
||||
|
||||
|
||||
extern bool AppActive;
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification*)aNotification
|
||||
{
|
||||
ZD_UNUSED(aNotification);
|
||||
|
||||
S_SetSoundPaused(1);
|
||||
|
||||
AppActive = true;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification*)aNotification
|
||||
{
|
||||
ZD_UNUSED(aNotification);
|
||||
|
||||
S_SetSoundPaused((!!i_soundinbackground) || 0);
|
||||
S_SetSoundPaused(i_soundinbackground);
|
||||
|
||||
AppActive = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -701,11 +701,6 @@ void SystemFrameBuffer::InitializeState()
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemFrameBuffer::CanUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SystemFrameBuffer::SwapBuffers()
|
||||
{
|
||||
[[NSOpenGLContext currentContext] flushBuffer];
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
virtual int GetTrueHeight() { return GetClientHeight(); }
|
||||
|
||||
protected:
|
||||
bool CanUpdate();
|
||||
void SetGammaTable(uint16_t *tbl);
|
||||
void ResetGammaTable();
|
||||
void InitializeState();
|
||||
|
|
|
@ -305,9 +305,16 @@ void MessagePump (const SDL_Event &sev)
|
|||
case SDL_WINDOWEVENT:
|
||||
switch (sev.window.event)
|
||||
{
|
||||
extern bool AppActive;
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
S_SetSoundPaused(1);
|
||||
AppActive = true;
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
S_SetSoundPaused((!!i_soundinbackground) || sev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED);
|
||||
S_SetSoundPaused(i_soundinbackground);
|
||||
AppActive = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -394,11 +394,6 @@ void SystemFrameBuffer::InitializeState()
|
|||
{
|
||||
}
|
||||
|
||||
bool SystemFrameBuffer::CanUpdate ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
bool CanUpdate();
|
||||
void ResetGammaTable();
|
||||
void SetGammaTable(uint16_t * tbl);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ LPDIRECTINPUT8 g_pdi;
|
|||
LPDIRECTINPUT g_pdi3;
|
||||
|
||||
|
||||
BOOL AppActive = TRUE;
|
||||
extern bool AppActive;
|
||||
int SessionState = 0;
|
||||
int BlockMouseMove;
|
||||
|
||||
|
@ -527,7 +527,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
AppActive = wParam;
|
||||
AppActive = wParam == TRUE;
|
||||
if (wParam)
|
||||
{
|
||||
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
|
||||
extern HWND Window;
|
||||
extern BOOL AppActive;
|
||||
|
||||
extern "C" {
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
|
@ -71,8 +70,6 @@ PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
|
|||
|
||||
|
||||
|
||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
||||
|
@ -1118,18 +1115,6 @@ void SystemFrameBuffer::InitializeState()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool SystemFrameBuffer::CanUpdate()
|
||||
{
|
||||
if (!AppActive && (IsFullscreen() || !vid_activeinbackground)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SystemFrameBuffer::ResetGammaTable()
|
||||
{
|
||||
if (m_supportsGamma)
|
||||
|
|
Loading…
Reference in a new issue