1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-11 14:44:07 +00:00

Allow downloading data while the game is minimized.

With this change, downloads should no longer abort when the game is
minimized for more than a few seconds.
This commit is contained in:
fgenesis 2013-06-24 03:39:48 +02:00
parent 9b658cb531
commit 1897329071
5 changed files with 19 additions and 11 deletions

View file

@ -5133,16 +5133,9 @@ void DSQ::cutsceneEffects(bool on)
} }
} }
void pauseSound() void DSQ::onBackgroundUpdate()
{ {
if (dsq && dsq->sound) { Network::update();
dsq->sound->pause(); Core::onBackgroundUpdate();
}
} }
void resumeSound()
{
if (dsq && dsq->sound) {
dsq->sound->resume();
}
}

View file

@ -1563,6 +1563,9 @@ public:
void pauseCutscene(bool on); void pauseCutscene(bool on);
bool canSkipCutscene(); bool canSkipCutscene();
bool isSkippingCutscene(); bool isSkippingCutscene();
virtual void onBackgroundUpdate();
protected: protected:
Quad *cutscene_bg; Quad *cutscene_bg;

View file

@ -244,6 +244,9 @@ void download(RequestData *rq)
void update() void update()
{ {
if(!netUp)
return;
RequestDataHolder h; RequestDataHolder h;
while(notifyRequests.pop(h)) while(notifyRequests.pop(h))
h.rq->notify(h.ev, h.recvd, h.total); h.rq->notify(h.ev, h.recvd, h.total);

View file

@ -2727,6 +2727,13 @@ bool Core::isWindowFocus()
return true; return true;
} }
void Core::onBackgroundUpdate()
{
#if BBGE_BUILD_SDL
SDL_Delay(200);
#endif
}
void Core::main(float runTime) void Core::main(float runTime)
{ {
bool verbose = coreVerboseDebug; bool verbose = coreVerboseDebug;
@ -2911,7 +2918,7 @@ void Core::main(float runTime)
{ {
pollEvents(); pollEvents();
//debugLog("app not in input focus"); //debugLog("app not in input focus");
SDL_Delay(200); onBackgroundUpdate();
resetTimer(); resetTimer();
} }

View file

@ -1310,6 +1310,8 @@ public:
volatile int dbg_numThreadDecoders; volatile int dbg_numThreadDecoders;
static unsigned int dbg_numRenderCalls; static unsigned int dbg_numRenderCalls;
virtual void onBackgroundUpdate();
protected: protected:
std::string fpsDebugString; std::string fpsDebugString;