mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
disable audio on lost focus
This commit is contained in:
parent
e630dcb7de
commit
996036bdf2
@ -24,6 +24,7 @@
|
||||
#include "../CMT.h"
|
||||
#include "../CPlayerInterface.h"
|
||||
#include "../CGameInfo.h"
|
||||
#include "../CMusicHandler.h"
|
||||
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
|
||||
@ -153,6 +154,18 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
if(settings["general"]["enableUiEnhancements"].Bool()) {
|
||||
CCS->musich->setVolume(settings["general"]["music"].Integer());
|
||||
CCS->soundh->setVolume(settings["general"]["sound"].Integer());
|
||||
}
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
if(settings["general"]["enableUiEnhancements"].Bool()) {
|
||||
CCS->musich->setVolume(0);
|
||||
CCS->soundh->setVolume(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user