- skip rendering when application is not active

Use vid_activeinbackground CVAR to override this behavior
This commit is contained in:
alexey.lysiuk 2018-05-04 11:24:37 +03:00
commit 2be84dc636
11 changed files with 25 additions and 45 deletions

View file

@ -65,7 +65,6 @@ protected:
void InitializeState();
bool CanUpdate();
void SwapBuffers();
void SetGammaTable(uint16_t* table);

View file

@ -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;
}

View file

@ -701,11 +701,6 @@ void SystemFrameBuffer::InitializeState()
{
}
bool SystemFrameBuffer::CanUpdate()
{
return true;
}
void SystemFrameBuffer::SwapBuffers()
{
[[NSOpenGLContext currentContext] flushBuffer];

View file

@ -33,7 +33,6 @@ public:
virtual int GetTrueHeight() { return GetClientHeight(); }
protected:
bool CanUpdate();
void SetGammaTable(uint16_t *tbl);
void ResetGammaTable();
void InitializeState();

View file

@ -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;

View file

@ -394,11 +394,6 @@ void SystemFrameBuffer::InitializeState()
{
}
bool SystemFrameBuffer::CanUpdate ()
{
return true;
}
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
{
if (m_supportsGamma)