mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Move global maintains above rendering
Also moves the call to the AudioFrontend constructor to take place in the GlobalState constructor Former-commit-id: 0be9df5a7355b6a7d1ce758894568d67df7db11a
This commit is contained in:
parent
22286c24e6
commit
6b0fc57ce3
@ -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.
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user