Port to Bevy 0.6.

This commit is contained in:
Nolan Darilek 2021-12-15 10:55:42 -06:00
parent 96a73f4c08
commit 56695c5994
2 changed files with 8 additions and 12 deletions

View File

@ -10,7 +10,7 @@ edition = "2021"
[dependencies]
alto = "3"
anyhow = "1"
bevy = { version = "0.5", default-features = false }
bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false }
claxon = "0.4"
hound = "3"
lewton = "0.10"

View File

@ -181,7 +181,7 @@ impl Default for SoundState {
}
}
#[derive(Clone, Reflect)]
#[derive(Component, Clone, Reflect)]
pub struct Sound {
pub buffer: Handle<Buffer>,
pub state: SoundState,
@ -242,7 +242,7 @@ impl Sound {
}
}
#[derive(Clone, Copy, Debug, Default, Reflect)]
#[derive(Component, Clone, Copy, Debug, Default, Reflect)]
#[reflect(Component)]
pub struct Listener;
@ -436,11 +436,11 @@ pub enum OpenAlSystem {
}
impl Plugin for OpenAlPlugin {
fn build(&self, app: &mut AppBuilder) {
if !app.world().contains_resource::<OpenAlConfig>() {
fn build(&self, app: &mut App) {
if !app.world.contains_resource::<OpenAlConfig>() {
app.insert_resource(OpenAlConfig::default());
}
let config = *app.world().get_resource::<OpenAlConfig>().unwrap();
let config = *app.world.get_resource::<OpenAlConfig>().unwrap();
let al = Alto::load_default().expect("Could not load alto");
let device = al.open(None).expect("Could not open device");
let mut context_attrs = ContextAttrs::default();
@ -457,11 +457,10 @@ impl Plugin for OpenAlPlugin {
.insert_resource(Buffers::default())
.insert_resource(GlobalEffects::default())
.register_type::<Listener>()
.add_system(buffer_creation.system())
.add_system(buffer_creation)
.add_system_to_stage(
CoreStage::PostUpdate,
update_listener
.system()
.label(OpenAlSystem::UpdateListener)
.after(TransformSystem::TransformPropagate)
.before(OpenAlSystem::UpdateSourceState),
@ -469,16 +468,13 @@ impl Plugin for OpenAlPlugin {
.add_system_to_stage(
CoreStage::PostUpdate,
update_source_properties
.system()
.label(OpenAlSystem::UpdateSourceProperties)
.after(TransformSystem::TransformPropagate)
.before(OpenAlSystem::UpdateSourceState),
)
.add_system_to_stage(
CoreStage::PostUpdate,
update_source_state
.system()
.label(OpenAlSystem::UpdateSourceState),
update_source_state.label(OpenAlSystem::UpdateSourceState),
);
}
}