Skip to content

Commit

Permalink
Option to test music
Browse files Browse the repository at this point in the history
  • Loading branch information
sago007 committed Nov 13, 2023
1 parent 747473d commit 397e4b1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions source/code/menudef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,19 @@ static void switchTheme() {
globalData.theme = getNextTheme();
}


static void testMusic() {
static bool highbeatNext = false;
int musicVolume = Config::getInstance()->getInt("volume_music");
std::string music_name = "bgmusic";
if (highbeatNext) {
music_name = "highbeat";
}
Mix_PlayMusic(globalData.spriteHolder->GetDataHolder().getMusicHandler(music_name.c_str()).get(), 1);
Mix_VolumeMusic(musicVolume);
highbeatNext = !highbeatNext; //Toggle between standard and highbeat
}

class ThemesMenu : public Menu {
private:
std::shared_ptr<BlockGameSdl> game;
Expand Down Expand Up @@ -470,6 +483,12 @@ static void OpenThemesMenu() {
bSwitchTheme.setLabel(_("Switch theme"));
bSwitchTheme.setAction(&switchTheme);
tm.addButton(&bSwitchTheme);
if (!globalData.NoSound) {
Button bTestMusic;
bTestMusic.setLabel(_("Test music"));
bTestMusic.setAction(&testMusic);
tm.addButton(&bTestMusic);
}
RunGameState(tm);
}

Expand Down

0 comments on commit 397e4b1

Please sign in to comment.