mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-26 07:22:45 +00:00
fix volume rounding
This commit is contained in:
parent
8a2e9fa569
commit
dc2476c9dd
|
@ -378,7 +378,7 @@ impl SettingsMenu {
|
|||
CurrentMenu::SoundMenu => match self.sound.tick(controller, state) {
|
||||
MenuSelectionResult::Left(0, bgm, direction) | MenuSelectionResult::Right(0, bgm, direction) => {
|
||||
if let MenuEntry::OptionsBar(_, value) = bgm {
|
||||
*value = (*value + (direction as f32 * 0.1)).clamp(0.0, 1.0);
|
||||
*value = (*value * 10.0 + (direction as f32)).clamp(0.0, 10.0) / 10.0;
|
||||
state.settings.bgm_volume = *value;
|
||||
state.sound_manager.set_song_volume(*value);
|
||||
|
||||
|
@ -387,7 +387,7 @@ impl SettingsMenu {
|
|||
}
|
||||
MenuSelectionResult::Left(1, sfx, direction) | MenuSelectionResult::Right(1, sfx, direction) => {
|
||||
if let MenuEntry::OptionsBar(_, value) = sfx {
|
||||
*value = (*value + (direction as f32 * 0.1)).clamp(0.0, 1.0);
|
||||
*value = (*value * 10.0 + (direction as f32)).clamp(0.0, 10.0) / 10.0;
|
||||
state.settings.sfx_volume = *value;
|
||||
state.sound_manager.set_sfx_volume(*value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue