mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Voxygen: Add inactive window volume
This commit is contained in:
parent
1d605c2dc8
commit
fd302b6975
@ -61,6 +61,15 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
||||
},
|
||||
winit::event::Event::WindowEvent { event, .. } => {
|
||||
span!(_guard, "Handle WindowEvent");
|
||||
|
||||
if let winit::event::WindowEvent::Focused(focused) = event {
|
||||
global_state.audio.set_master_volume(if focused {
|
||||
global_state.settings.audio.master_volume
|
||||
} else {
|
||||
global_state.settings.audio.inactive_master_volume
|
||||
});
|
||||
}
|
||||
|
||||
global_state
|
||||
.window
|
||||
.handle_window_event(event, &mut global_state.settings)
|
||||
|
@ -21,6 +21,7 @@ impl AudioOutput {
|
||||
#[serde(default)]
|
||||
pub struct AudioSettings {
|
||||
pub master_volume: f32,
|
||||
pub inactive_master_volume: f32,
|
||||
pub music_volume: f32,
|
||||
pub sfx_volume: f32,
|
||||
pub max_sfx_channels: usize,
|
||||
@ -33,6 +34,7 @@ impl Default for AudioSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
master_volume: 1.0,
|
||||
inactive_master_volume: 0.5,
|
||||
music_volume: 0.4,
|
||||
sfx_volume: 0.6,
|
||||
max_sfx_channels: 30,
|
||||
|
Loading…
Reference in New Issue
Block a user