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
59032b69c9
commit
476742d72a
@ -61,6 +61,15 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
|||||||
},
|
},
|
||||||
winit::event::Event::WindowEvent { event, .. } => {
|
winit::event::Event::WindowEvent { event, .. } => {
|
||||||
span!(_guard, "Handle WindowEvent");
|
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
|
global_state
|
||||||
.window
|
.window
|
||||||
.handle_window_event(event, &mut global_state.settings)
|
.handle_window_event(event, &mut global_state.settings)
|
||||||
|
@ -21,6 +21,7 @@ impl AudioOutput {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct AudioSettings {
|
pub struct AudioSettings {
|
||||||
pub master_volume: f32,
|
pub master_volume: f32,
|
||||||
|
pub inactive_master_volume: f32,
|
||||||
pub music_volume: f32,
|
pub music_volume: f32,
|
||||||
pub sfx_volume: f32,
|
pub sfx_volume: f32,
|
||||||
pub max_sfx_channels: usize,
|
pub max_sfx_channels: usize,
|
||||||
@ -33,6 +34,7 @@ impl Default for AudioSettings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
master_volume: 1.0,
|
master_volume: 1.0,
|
||||||
|
inactive_master_volume: 0.5,
|
||||||
music_volume: 0.4,
|
music_volume: 0.4,
|
||||||
sfx_volume: 0.6,
|
sfx_volume: 0.6,
|
||||||
max_sfx_channels: 30,
|
max_sfx_channels: 30,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user