mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Voxygen: Add master volume sliders to the settings
This commit is contained in:
parent
fd302b6975
commit
f23b515dd8
@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Players can now opt-in to server-authoritiative physics in gameplay settings.
|
||||
- Added `/server_physics` admin command.
|
||||
- Sort inventory button
|
||||
- Option to change the master volume when window is unfocused
|
||||
|
||||
|
||||
### Changed
|
||||
@ -77,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Combat rating no longer takes buffs into account
|
||||
- Minimap icons are now displayed in both map modes
|
||||
- Server now denies any running trades when a user exits to the character selection screen.
|
||||
- Sfx volume changes now also change the ambient sounds volume
|
||||
|
||||
## [0.9.0] - 2021-03-20
|
||||
|
||||
|
@ -94,6 +94,8 @@
|
||||
"hud.settings.reset_graphics": "Reset to Defaults",
|
||||
|
||||
|
||||
"hud.settings.master_volume": "Master Volume",
|
||||
"hud.settings.inactive_master_volume": "Master Volume (inactive window)",
|
||||
"hud.settings.music_volume": "Music Volume",
|
||||
"hud.settings.sound_effect_volume": "Sound Effects Volume",
|
||||
"hud.settings.audio_device": "Audio Device",
|
||||
|
@ -24,6 +24,10 @@ widget_ids! {
|
||||
audio_volume_text,
|
||||
sfx_volume_slider,
|
||||
sfx_volume_text,
|
||||
master_volume_slider,
|
||||
master_volume_text,
|
||||
inactive_master_volume_slider,
|
||||
inactive_master_volume_text,
|
||||
audio_device_list,
|
||||
audio_device_text,
|
||||
}
|
||||
@ -93,9 +97,63 @@ impl<'a> Widget for Sound<'a> {
|
||||
.rgba(0.33, 0.33, 0.33, 1.0)
|
||||
.set(state.ids.window_scrollbar, ui);
|
||||
|
||||
// Master Volume ----------------------------------------------------
|
||||
Text::new(&self.localized_strings.get("hud.settings.master_volume"))
|
||||
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.master_volume_text, ui);
|
||||
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.master_volume,
|
||||
0.0,
|
||||
1.0,
|
||||
self.imgs.slider_indicator,
|
||||
self.imgs.slider,
|
||||
)
|
||||
.w_h(104.0, 22.0)
|
||||
.down_from(state.ids.master_volume_text, 10.0)
|
||||
.track_breadth(12.0)
|
||||
.slider_length(10.0)
|
||||
.pad_track((5.0, 5.0))
|
||||
.set(state.ids.master_volume_slider, ui)
|
||||
{
|
||||
events.push(AdjustMasterVolume(new_val));
|
||||
}
|
||||
|
||||
// Master Volume (inactive window) ----------------------------------
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get("hud.settings.inactive_master_volume"),
|
||||
)
|
||||
.down_from(state.ids.master_volume_slider, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.inactive_master_volume_text, ui);
|
||||
|
||||
if let Some(new_val) = ImageSlider::continuous(
|
||||
self.global_state.settings.audio.inactive_master_volume,
|
||||
0.0,
|
||||
1.0,
|
||||
self.imgs.slider_indicator,
|
||||
self.imgs.slider,
|
||||
)
|
||||
.w_h(104.0, 22.0)
|
||||
.down_from(state.ids.inactive_master_volume_text, 10.0)
|
||||
.track_breadth(12.0)
|
||||
.slider_length(10.0)
|
||||
.pad_track((5.0, 5.0))
|
||||
.set(state.ids.inactive_master_volume_slider, ui)
|
||||
{
|
||||
events.push(AdjustInactiveMasterVolume(new_val));
|
||||
}
|
||||
|
||||
// Music Volume -----------------------------------------------------
|
||||
Text::new(&self.localized_strings.get("hud.settings.music_volume"))
|
||||
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
|
||||
.down_from(state.ids.inactive_master_volume_slider, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -19,6 +19,8 @@ use vek::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Audio {
|
||||
AdjustMasterVolume(f32),
|
||||
AdjustInactiveMasterVolume(f32),
|
||||
AdjustMusicVolume(f32),
|
||||
AdjustSfxVolume(f32),
|
||||
//ChangeAudioDevice(String),
|
||||
@ -153,6 +155,14 @@ impl SettingsChange {
|
||||
match self {
|
||||
SettingsChange::Audio(audio_change) => {
|
||||
match audio_change {
|
||||
Audio::AdjustMasterVolume(master_volume) => {
|
||||
global_state.audio.set_master_volume(master_volume);
|
||||
|
||||
settings.audio.master_volume = master_volume;
|
||||
},
|
||||
Audio::AdjustInactiveMasterVolume(inactive_master_volume) => {
|
||||
settings.audio.inactive_master_volume = inactive_master_volume;
|
||||
},
|
||||
Audio::AdjustMusicVolume(music_volume) => {
|
||||
global_state.audio.set_music_volume(music_volume);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user