From b381e1501fba06f0871f84c6498b6ca1466a9af0 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 6 Mar 2023 14:24:23 -0600 Subject: [PATCH] chore: Update to Bevy 0.10. --- Cargo.toml | 4 +-- examples/buffer.rs | 2 +- src/lib.rs | 83 ++++++++++++++++++++++++---------------------- 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 64face3..17ec5ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,11 @@ repository = "https://labs.lightsout.games/projects/bevy_synthizer" [dependencies] anyhow = "1" -bevy = { version = "0.9", default-features = false, features = ["bevy_asset"] } +bevy = { version = "0.10", default-features = false, features = ["bevy_asset"] } synthizer = "0.5.6" [dev-dependencies] -bevy = { version = "0.9", default-features = true } +bevy = { version = "0.10", default-features = true } [package.metadata.release] publish = false diff --git a/examples/buffer.rs b/examples/buffer.rs index d1b93a0..ba97194 100644 --- a/examples/buffer.rs +++ b/examples/buffer.rs @@ -31,7 +31,7 @@ fn load_and_create( return; } handles.loaded = asset_server - .get_group_load_state(handles.sounds.iter().map(|handle| handle.id)) + .get_group_load_state(handles.sounds.iter().map(|handle| handle.id())) == LoadState::Loaded; if handles.loaded { commands.spawn(( diff --git a/src/lib.rs b/src/lib.rs index 2124e7f..5d025f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -365,8 +365,8 @@ fn swap_buffers( } fn change_panner_strategy( - changed: Query<(Entity, ChangeTrackers)>, - removed: RemovedComponents, + changed: Query<(Entity, Ref)>, + mut removed: RemovedComponents, mut sources: Query<&mut Source>, ) { let mut check = vec![]; @@ -589,7 +589,7 @@ fn update_sound_playback_state(query: Query<&Sound>) { } } -fn remove_sound(mut last_buffer: ResMut, removed: RemovedComponents) { +fn remove_sound(mut last_buffer: ResMut, mut removed: RemovedComponents) { for entity in removed.iter() { last_buffer.remove(&entity); } @@ -691,7 +691,7 @@ fn events( }); } -#[derive(SystemLabel, Clone, Hash, Debug, PartialEq, Eq)] +#[derive(SystemSet, Clone, Hash, Debug, PartialEq, Eq)] pub enum SynthizerSystems { UpdateHandles, UpdateProperties, @@ -756,65 +756,70 @@ impl Plugin for SynthizerPlugin { .init_resource::() .insert_resource(defaults) .add_event::() - .add_system_to_stage(CoreStage::PreUpdate, sync_config) - .add_system_to_stage( - CoreStage::PostUpdate, - swap_buffers.before(SynthizerSystems::UpdateHandles), + .add_system(sync_config.in_base_set(CoreSet::PreUpdate)) + .add_system( + swap_buffers + .in_base_set(CoreSet::PostUpdate) + .before(SynthizerSystems::UpdateHandles), ) - .add_system_to_stage( - CoreStage::PostUpdate, - change_panner_strategy.before(SynthizerSystems::UpdateHandles), + .add_system( + change_panner_strategy + .in_base_set(CoreSet::PostUpdate) + .before(SynthizerSystems::UpdateHandles), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( add_source_handle - .label(SynthizerSystems::UpdateHandles) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateHandles) .before(SynthizerSystems::UpdateProperties), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( add_generator - .label(SynthizerSystems::UpdateHandles) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateHandles) .before(SynthizerSystems::UpdateProperties), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( add_sound_without_source - .label(SynthizerSystems::UpdateHandles) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateHandles) .before(SynthizerSystems::UpdateProperties), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( update_listener - .label(SynthizerSystems::UpdateProperties) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateProperties) .after(TransformSystem::TransformPropagate) .before(SynthizerSystems::UpdateState), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( update_source_properties - .label(SynthizerSystems::UpdateProperties) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateProperties) .after(TransformSystem::TransformPropagate) .before(SynthizerSystems::UpdateState), ) - .add_system_to_stage( - CoreStage::PostUpdate, + .add_system( update_sound_properties - .label(SynthizerSystems::UpdateProperties) + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateProperties) .before(SynthizerSystems::UpdateState), ) - .add_system_to_stage( - CoreStage::PostUpdate, - update_source_playback_state.label(SynthizerSystems::UpdateState), + .add_system( + update_source_playback_state + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateState), ) - .add_system_to_stage( - CoreStage::PostUpdate, - update_sound_playback_state.label(SynthizerSystems::UpdateState), + .add_system( + update_sound_playback_state + .in_base_set(CoreSet::PostUpdate) + .in_set(SynthizerSystems::UpdateState), ) - .add_system_to_stage(CoreStage::PostUpdate, remove_sound) - .add_system_to_stage( - CoreStage::PostUpdate, - events.after(SynthizerSystems::UpdateState), + .add_system(remove_sound.in_base_set(CoreSet::PostUpdate)) + .add_system( + events + .in_base_set(CoreSet::PostUpdate) + .after(SynthizerSystems::UpdateState), ); } }