Save view distance, volume, and audio device to settings when changed

Former-commit-id: ac7db47520c6524b3f2d7a788907daabb73ad237
This commit is contained in:
Louis Pearson 2019-05-20 14:18:01 -06:00
parent c8928587dd
commit f52954971d

View File

@ -191,13 +191,22 @@ impl PlayState for SessionState {
return PlayStateResult::Shutdown;
}
HudEvent::AdjustViewDistance(view_distance) => {
self.client.borrow_mut().set_view_distance(view_distance)
self.client.borrow_mut().set_view_distance(view_distance);
global_state.settings.graphics.view_distance = view_distance;
global_state.settings.save_to_file();
}
HudEvent::AdjustVolume(volume) => {
global_state.audio.set_volume(volume);
global_state.settings.audio.music_volume = volume;
global_state.settings.save_to_file();
}
HudEvent::ChangeAudioDevice(name) => {
global_state.audio.set_device(name);
global_state.audio.set_device(name.clone());
global_state.settings.audio.audio_device = name;
global_state.settings.save_to_file();
}
}
}