1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Pause audio when tabbing out

TODO: Figure out why title music and toilet sounds are still playing

Add an option to disable this feature so that people can jam out to the
carousel music while tabbed out.
This commit is contained in:
medsouz
2015-08-11 00:42:18 -04:00
parent 4ee464fb1b
commit 3ce6d7020b

View File

@@ -19,6 +19,7 @@
*****************************************************************************/
#include "../addresses.h"
#include "../audio/audio.h"
#include "../config.h"
#include "../cursors.h"
#include "../drawing/drawing.h"
@@ -351,6 +352,16 @@ void platform_process_messages()
case SDL_WINDOWEVENT:
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
platform_resize(e.window.data1, e.window.data2);
if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
if (gConfigSound.sound) {
unpause_sounds();
}
}
if (e.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
if (gConfigSound.sound) {
pause_sounds();
}
}
break;
case SDL_MOUSEMOTION:
RCT2_GLOBAL(0x0142406C, int) = e.motion.x;