mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 20:20:25 +02:00
pausing sound when app is not active
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "window/Window.h"
|
#include "window/Window.h"
|
||||||
#include "common/Exception.h"
|
#include "common/Exception.h"
|
||||||
|
#include "audio/Audio.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@@ -414,6 +415,22 @@ Message *Event::convertWindowEvent(const SDL_Event &e) const
|
|||||||
arg1->release();
|
arg1->release();
|
||||||
arg2->release();
|
arg2->release();
|
||||||
break;
|
break;
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
case SDL_WINDOWEVENT_MINIMIZED:
|
||||||
|
{
|
||||||
|
audio::Audio *audio = (audio::Audio *) Module::findInstance("love.audio.");
|
||||||
|
if (audio)
|
||||||
|
audio->pause();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDL_WINDOWEVENT_RESTORED:
|
||||||
|
{
|
||||||
|
audio::Audio *audio = (audio::Audio *) Module::findInstance("love.audio.");
|
||||||
|
if (audio)
|
||||||
|
audio->resume();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
|||||||
Reference in New Issue
Block a user