From 2c4091f845513cee2de4aac652f9720c74789327 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Tue, 7 Jan 2025 14:32:43 +0100 Subject: audio stopped at end of level --- game/menus/ButtonSetMainMenuScript.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'game') diff --git a/game/menus/ButtonSetMainMenuScript.cpp b/game/menus/ButtonSetMainMenuScript.cpp index 12b7256..e9232b5 100644 --- a/game/menus/ButtonSetMainMenuScript.cpp +++ b/game/menus/ButtonSetMainMenuScript.cpp @@ -1,5 +1,7 @@ #include "ButtonSetMainMenuScript.h" #include "MenusConfig.h" +#include "api/AudioSource.h" +#include "types.h" using namespace crepe; using namespace std; @@ -10,6 +12,12 @@ void ButtonSetMainMenuScript::init(){ } bool ButtonSetMainMenuScript::on_button_press(const ButtonPressEvent& e){ + RefVector audios = this->get_components_by_name("background_music"); + + for (AudioSource & audio : audios) { + audio.stop(); + } + this->set_next_scene(MAINMENU_SCENE); return false; } -- cgit v1.2.3