git repos / blockattack-game

commit 4482071a

Poul Sander · 2021-06-05 15:07
4482071a176ab77c81471d845cc8623c13075f85 patch · browse files
parent 75741e4a2588afd4c38bba19f34c2e0e1d30b57c

Show volume pct instead of "On" for sound and music

Changed files

M source/code/menudef.cpp before
diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp index 04a61f2..6348b12 100644 --- a/source/code/menudef.cpp +++ b/source/code/menudef.cpp
@@ -213,11 +213,25 @@ static void SetAlwaysSoftwareLabel(Button* b) {
}
static void SetMusicLabel (Button* b) {
- b->setLabel(globalData.MusicEnabled? _("Music: On") : _("Music: Off") );
+ if (globalData.MusicEnabled) {
+ double volume = Config::getInstance()->getInt("volume_music");
+ int volumePct = volume*100.0/MIX_MAX_VOLUME;
+ b->setLabel(std::string(_("Music: "))+ std::to_string(volumePct)+"%" );
+ }
+ else {
+ b->setLabel(_("Music: Off") );
+ }
}
static void SetSoundLabel (Button* b) {
- b->setLabel(globalData.SoundEnabled? _("Sound: On") : _("Sound: Off") );
+ if (globalData.SoundEnabled) {
+ double volume = Config::getInstance()->getInt("volume_sound");
+ int volumePct = volume*100.0/MIX_MAX_VOLUME;
+ b->setLabel(std::string(_("Sound: "))+ std::to_string(volumePct)+"%" );
+ }
+ else {
+ b->setLabel(_("Sound: Off") );
+ }
}
static void SetFullscreenLabel (Button* b) {