diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 69f0865df5..76f99a94d4 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -97,8 +97,6 @@ fn main() { ]) .unwrap(); - let audio = AudioFrontend::new(); - // Set up panic handler to relay swish panic messages to the user let settings_clone = settings.clone(); let default_hook = panic::take_hook(); @@ -164,7 +162,7 @@ fn main() { let mut global_state = GlobalState { settings, window, - audio, + audio: AudioFrontend::new(), }; // Set up the initial play state. diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index 3dbe15ec3f..85c93fce63 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -90,6 +90,9 @@ impl PlayState for CharSelectionState { } } + // Mantain global state + global_state.maintain(); + // Maintain the scene. self.scene .maintain(global_state.window.renderer_mut(), &self.client.borrow()); @@ -119,9 +122,6 @@ impl PlayState for CharSelectionState { .swap_buffers() .expect("Failed to swap window buffers"); - // Mantain global state - global_state.maintain(); - // Wait for the next tick. clock.tick(Duration::from_millis(1000 / FPS)); } diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index 5fa07a7ebf..2cdd432e7b 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -86,6 +86,9 @@ impl PlayState for MainMenuState { None => {} } + // Maintain global_state + global_state.maintain(); + // Maintain the UI. for event in self.main_menu_ui.maintain(global_state) { match event { @@ -124,9 +127,6 @@ impl PlayState for MainMenuState { .swap_buffers() .expect("Failed to swap window buffers!"); - // Maintain global_state - global_state.maintain(); - // Wait for the next tick clock.tick(Duration::from_millis(1000 / FPS)); } diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index f07588f707..8b958d5a21 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -167,11 +167,15 @@ impl PlayState for SessionState { self.tick(clock.get_last_delta()) .expect("Failed to tick the scene!"); + // Maintain global state + global_state.maintain(); + // Maintain the scene. self.scene.maintain( global_state.window.renderer_mut(), &mut self.client.borrow_mut(), ); + // Maintain the UI. for event in self .hud @@ -198,9 +202,6 @@ impl PlayState for SessionState { .swap_buffers() .expect("Failed to swap window buffers!"); - // Maintain global state - global_state.maintain(); - // Wait for the next tick. clock.tick(Duration::from_millis(1000 / FPS));