Play random music whenever a track ends

To support this, a global_state.maintain() method was added that calls
audio.maintain().


Former-commit-id: e5d20719291ee17096070dfcacec760e45937f7a
This commit is contained in:
Louis Pearson
2019-05-18 13:28:12 -06:00
parent 315767f19f
commit 22286c24e6
7 changed files with 374 additions and 51 deletions

View File

@ -47,10 +47,6 @@ impl PlayState for MainMenuState {
// Used for client creation.
let mut client_init: Option<ClientInit> = None;
global_state
.audio
.play_music("voxygen/audio/soundtrack/veloren_title_tune-3.ogg");
loop {
// Handle window events.
for event in global_state.window.fetch_events() {
@ -128,7 +124,10 @@ impl PlayState for MainMenuState {
.swap_buffers()
.expect("Failed to swap window buffers!");
// Wait for the next tick.
// Maintain global_state
global_state.maintain();
// Wait for the next tick
clock.tick(Duration::from_millis(1000 / FPS));
}
}