mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 22:39:53 +00:00
refactor sound-related settings
also only show music volume setting when music is available
This commit is contained in:
parent
41952afdcd
commit
2319dce683
68
config.cpp
68
config.cpp
@ -1086,6 +1086,43 @@ EX void menuitem_sightrange(char c IS('c')) {
|
|||||||
dialog::add_action(edit_sightrange);
|
dialog::add_action(edit_sightrange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void menuitem_sfx_volume() {
|
||||||
|
dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e');
|
||||||
|
dialog::add_action([] {
|
||||||
|
dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), "");
|
||||||
|
dialog::numberdark = dialog::DONT_SHOW;
|
||||||
|
dialog::reaction = [] () {
|
||||||
|
#if ISANDROID
|
||||||
|
settingsChanged = true;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
dialog::bound_low(0);
|
||||||
|
dialog::bound_up(MIX_MAX_VOLUME);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
EX void menuitem_music_volume() {
|
||||||
|
if (!audio) return;
|
||||||
|
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
|
||||||
|
dialog::add_action([] {
|
||||||
|
dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), "");
|
||||||
|
dialog::numberdark = dialog::DONT_SHOW;
|
||||||
|
dialog::reaction = [] () {
|
||||||
|
#if CAP_SDLAUDIO
|
||||||
|
Mix_VolumeMusic(musicvolume);
|
||||||
|
#endif
|
||||||
|
#if ISANDROID
|
||||||
|
settingsChanged = true;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
dialog::bound_low(0);
|
||||||
|
dialog::bound_up(MIX_MAX_VOLUME);
|
||||||
|
dialog::extra_options = [] {
|
||||||
|
dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
EX void showSpecialEffects() {
|
EX void showSpecialEffects() {
|
||||||
cmode = vid.xres > vid.yres * 1.4 ? sm::SIDE : sm::MAYDARK;
|
cmode = vid.xres > vid.yres * 1.4 ? sm::SIDE : sm::MAYDARK;
|
||||||
gamescreen(0);
|
gamescreen(0);
|
||||||
@ -1337,35 +1374,8 @@ EX void configureOther() {
|
|||||||
// dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
|
// dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
|
||||||
|
|
||||||
#if CAP_AUDIO
|
#if CAP_AUDIO
|
||||||
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
|
menuitem_music_volume();
|
||||||
dialog::add_action([] {
|
menuitem_sfx_volume();
|
||||||
dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), "");
|
|
||||||
dialog::reaction = [] () {
|
|
||||||
#if CAP_SDLAUDIO
|
|
||||||
Mix_VolumeMusic(musicvolume);
|
|
||||||
#endif
|
|
||||||
#if ISANDROID
|
|
||||||
settingsChanged = true;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
dialog::bound_low(0);
|
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
|
||||||
dialog::extra_options = [] {
|
|
||||||
dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A');
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e');
|
|
||||||
dialog::add_action([] {
|
|
||||||
dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), "");
|
|
||||||
dialog::reaction = [] () {
|
|
||||||
#if ISANDROID
|
|
||||||
settingsChanged = true;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
dialog::bound_low(0);
|
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
|
||||||
});
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
menuitem_sightrange('r');
|
menuitem_sightrange('r');
|
||||||
|
@ -1295,19 +1295,9 @@ void settings_menu() {
|
|||||||
dialog::add_action_push(multi::get_key_configurer(1, move_names, "Bringris keys"));
|
dialog::add_action_push(multi::get_key_configurer(1, move_names, "Bringris keys"));
|
||||||
|
|
||||||
#if CAP_AUDIO
|
#if CAP_AUDIO
|
||||||
dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e');
|
menuitem_sfx_volume();
|
||||||
dialog::add_action([] {
|
menuitem_music_volume();
|
||||||
dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), "");
|
#endif
|
||||||
dialog::numberdark = dialog::DONT_SHOW;
|
|
||||||
dialog::reaction = [] () {
|
|
||||||
#if ISANDROID
|
|
||||||
settingsChanged = true;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
dialog::bound_low(0);
|
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user