fix: la musica del mode DEMO no era la correcta

This commit is contained in:
2025-03-07 22:29:17 +01:00
parent 09ac952404
commit 9cf0891a04
2 changed files with 16 additions and 1 deletions

View File

@@ -151,7 +151,7 @@ void Game::update()
} }
DEMO_checkRoomChange(); DEMO_checkRoomChange();
scoreboard_->update(); scoreboard_->update();
keepMusicPlaying();
updateBlackScreen(); updateBlackScreen();
Screen::get()->update(); Screen::get()->update();
@@ -699,3 +699,15 @@ void Game::DEMO_checkRoomChange()
} }
} }
} }
// Hace sonar la música
void Game::keepMusicPlaying()
{
const std::string music_path = mode_ == GameMode::GAME ? "game.ogg" : "title.ogg";
// Si la música no está sonando
if (JA_GetMusicState() == JA_MUSIC_INVALID || JA_GetMusicState() == JA_MUSIC_STOPPED)
{
JA_PlayMusic(Resource::get()->getMusic(music_path));
}
}

View File

@@ -157,6 +157,9 @@ private:
// DEMO MODE: Comprueba si se ha de cambiar de habitación // DEMO MODE: Comprueba si se ha de cambiar de habitación
void DEMO_checkRoomChange(); void DEMO_checkRoomChange();
// Hace sonar la música
void keepMusicPlaying();
public: public:
// Constructor // Constructor
Game(GameMode mode); Game(GameMode mode);