From bca688a9a727d850adbf85a512e37025f0dc0bef Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 3 Aug 2024 14:12:40 +0200 Subject: [PATCH] =?UTF-8?q?afegida=20opci=C3=B3=20per=20habilitar=20o=20de?= =?UTF-8?q?shabilitar=20el=20audio=20desde=20el=20teclat.=20De=20moment=20?= =?UTF-8?q?soles=20desde=20el=20joc.=20En=20poder=20ho=20integrar=C3=A9=20?= =?UTF-8?q?en=20jail=5Faudio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/director.cpp | 1 + source/game.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/source/director.cpp b/source/director.cpp index a3d691a..ad01640 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -123,6 +123,7 @@ void Director::initInput() input->bindKey(input_window_inc_size, SDL_SCANCODE_F2); input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3); input->bindKey(input_video_shaders, SDL_SCANCODE_F4); + input->bindKey(input_mute, SDL_SCANCODE_F5); input->bindKey(input_reset, SDL_SCANCODE_F10); const int numGamePads = input->getNumControllers(); diff --git a/source/game.cpp b/source/game.cpp index 6cb377f..c01f9d1 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -2137,6 +2137,18 @@ void Game::checkInput() return; } + else if (input->checkInput(input_mute, DO_NOT_ALLOW_REPEAT)) + { + const bool value = !options->audio.music.enabled; + options->audio.music.enabled = value; + options->audio.sound.enabled = value; + JA_EnableMusic(value); + JA_EnableSound(value); + const std::string text = value ? "on" : "off"; + screen->showNotification("Audio " + text); + return; + } + else if (input->checkInput(input_pause, DO_NOT_ALLOW_REPEAT)) { pause(!paused);