Update to Bevy 0.7.

This commit is contained in:
Nolan Darilek 2022-05-03 09:22:32 -05:00
parent 763e1c361f
commit 7fc4f09c87
3 changed files with 12 additions and 11 deletions

View File

@ -10,9 +10,8 @@ edition = "2021"
[dependencies] [dependencies]
alto = "3" alto = "3"
anyhow = "1" anyhow = "1"
bevy = { version = "0.6", default-features = false } bevy = { version = "0.7", default-features = false }
claxon = "0.4" claxon = "0.4"
derive_more = "0.99"
hound = "3" hound = "3"
lewton = "0.10" lewton = "0.10"
minimp3 = "0.5" minimp3 = "0.5"

View File

@ -35,7 +35,10 @@ fn load_and_create(
.get_group_load_state(handles.sounds.iter().map(|handle| handle.id)) .get_group_load_state(handles.sounds.iter().map(|handle| handle.id))
== LoadState::Loaded; == LoadState::Loaded;
if handles.loaded { if handles.loaded {
commands.spawn().insert(Listener).insert(Transform::default); commands
.spawn()
.insert(Listener)
.insert(Transform::default());
let handle = handles.sounds[0].clone(); let handle = handles.sounds[0].clone();
let buffer = asset_server.get_handle(handle); let buffer = asset_server.get_handle(handle);
commands commands
@ -46,18 +49,18 @@ fn load_and_create(
state: SoundState::Playing, state: SoundState::Playing,
gain: 0.4, gain: 0.4,
looping: true, looping: true,
..Default::default() ..default()
}); });
} }
} }
fn main() { fn main() {
App::build() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system.system()) .add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(OpenAlPlugin) .add_plugin(OpenAlPlugin)
.init_resource::<AssetHandles>() .init_resource::<AssetHandles>()
.add_startup_system(setup.system()) .add_startup_system(setup)
.add_system(load_and_create.system()) .add_system(load_and_create)
.run(); .run();
} }

View File

@ -13,7 +13,6 @@ use bevy::{
transform::TransformSystem, transform::TransformSystem,
utils::BoxedFuture, utils::BoxedFuture,
}; };
use derive_more::{Deref, DerefMut};
use lewton::inside_ogg::OggStreamReader; use lewton::inside_ogg::OggStreamReader;
use minimp3::{Decoder, Error}; use minimp3::{Decoder, Error};
@ -206,8 +205,8 @@ pub struct Sound {
impl Default for Sound { impl Default for Sound {
fn default() -> Self { fn default() -> Self {
Self { Self {
buffer: Default::default(), buffer: default(),
state: Default::default(), state: default(),
gain: 1., gain: 1.,
looping: false, looping: false,
pitch: 1., pitch: 1.,