mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	disable audio on lost focus
This commit is contained in:
		| @@ -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; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user