mirror of
https://github.com/lightsoutgames/bevy_openal.git
synced 2024-11-24 02:05:57 +00:00
Port to Bevy 0.6.
This commit is contained in:
parent
96a73f4c08
commit
56695c5994
|
@ -10,7 +10,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
alto = "3"
|
alto = "3"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
bevy = { version = "0.5", default-features = false }
|
bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false }
|
||||||
claxon = "0.4"
|
claxon = "0.4"
|
||||||
hound = "3"
|
hound = "3"
|
||||||
lewton = "0.10"
|
lewton = "0.10"
|
||||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -181,7 +181,7 @@ impl Default for SoundState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Reflect)]
|
#[derive(Component, Clone, Reflect)]
|
||||||
pub struct Sound {
|
pub struct Sound {
|
||||||
pub buffer: Handle<Buffer>,
|
pub buffer: Handle<Buffer>,
|
||||||
pub state: SoundState,
|
pub state: SoundState,
|
||||||
|
@ -242,7 +242,7 @@ impl Sound {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, Reflect)]
|
#[derive(Component, Clone, Copy, Debug, Default, Reflect)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component)]
|
||||||
pub struct Listener;
|
pub struct Listener;
|
||||||
|
|
||||||
|
@ -436,11 +436,11 @@ pub enum OpenAlSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Plugin for OpenAlPlugin {
|
impl Plugin for OpenAlPlugin {
|
||||||
fn build(&self, app: &mut AppBuilder) {
|
fn build(&self, app: &mut App) {
|
||||||
if !app.world().contains_resource::<OpenAlConfig>() {
|
if !app.world.contains_resource::<OpenAlConfig>() {
|
||||||
app.insert_resource(OpenAlConfig::default());
|
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 al = Alto::load_default().expect("Could not load alto");
|
||||||
let device = al.open(None).expect("Could not open device");
|
let device = al.open(None).expect("Could not open device");
|
||||||
let mut context_attrs = ContextAttrs::default();
|
let mut context_attrs = ContextAttrs::default();
|
||||||
|
@ -457,11 +457,10 @@ impl Plugin for OpenAlPlugin {
|
||||||
.insert_resource(Buffers::default())
|
.insert_resource(Buffers::default())
|
||||||
.insert_resource(GlobalEffects::default())
|
.insert_resource(GlobalEffects::default())
|
||||||
.register_type::<Listener>()
|
.register_type::<Listener>()
|
||||||
.add_system(buffer_creation.system())
|
.add_system(buffer_creation)
|
||||||
.add_system_to_stage(
|
.add_system_to_stage(
|
||||||
CoreStage::PostUpdate,
|
CoreStage::PostUpdate,
|
||||||
update_listener
|
update_listener
|
||||||
.system()
|
|
||||||
.label(OpenAlSystem::UpdateListener)
|
.label(OpenAlSystem::UpdateListener)
|
||||||
.after(TransformSystem::TransformPropagate)
|
.after(TransformSystem::TransformPropagate)
|
||||||
.before(OpenAlSystem::UpdateSourceState),
|
.before(OpenAlSystem::UpdateSourceState),
|
||||||
|
@ -469,16 +468,13 @@ impl Plugin for OpenAlPlugin {
|
||||||
.add_system_to_stage(
|
.add_system_to_stage(
|
||||||
CoreStage::PostUpdate,
|
CoreStage::PostUpdate,
|
||||||
update_source_properties
|
update_source_properties
|
||||||
.system()
|
|
||||||
.label(OpenAlSystem::UpdateSourceProperties)
|
.label(OpenAlSystem::UpdateSourceProperties)
|
||||||
.after(TransformSystem::TransformPropagate)
|
.after(TransformSystem::TransformPropagate)
|
||||||
.before(OpenAlSystem::UpdateSourceState),
|
.before(OpenAlSystem::UpdateSourceState),
|
||||||
)
|
)
|
||||||
.add_system_to_stage(
|
.add_system_to_stage(
|
||||||
CoreStage::PostUpdate,
|
CoreStage::PostUpdate,
|
||||||
update_source_state
|
update_source_state.label(OpenAlSystem::UpdateSourceState),
|
||||||
.system()
|
|
||||||
.label(OpenAlSystem::UpdateSourceState),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user