diff --git a/Cargo.toml b/Cargo.toml index c879a93..d88f511 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,11 @@ exclude = [ ] [dependencies] -bevy = { version = "0.14", default-features = false } +bevy = { version = "0.15", default-features = false } libfmod = "~2.222.6" [dev-dependencies.bevy] -version = "0.14" +version = "0.15" features = [ "bevy_core_pipeline", "bevy_render", diff --git a/examples/audio_control.rs b/examples/audio_control.rs index e093989..440cf82 100644 --- a/examples/audio_control.rs +++ b/examples/audio_control.rs @@ -37,7 +37,7 @@ fn startup(mut commands: Commands, studio: Res) { }); // In this case only needed to show the controls: - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d::default()); } fn play_music(mut audio_sources: Query<&AudioSource, With>) { @@ -65,10 +65,10 @@ fn audio_control(query: Query<&AudioSource>, input: Res>) { } fn display_controls(mut commands: Commands) { - commands.spawn(TextBundle::from_sections([ - TextSection::from("Controls: \n"), - TextSection::from("S: Stop \n"), - TextSection::from("P: Play \n"), - TextSection::from("T: Toggle \n"), - ])); + commands.spawn(Text::default()).with_children(|parent| { + parent.spawn(TextSpan::new("Controls: \n")); + parent.spawn(TextSpan::new("S: Stop \n")); + parent.spawn(TextSpan::new("P: Play \n")); + parent.spawn(TextSpan::new("T: Toggle Play/Pause \n")); + }); } diff --git a/examples/parameters.rs b/examples/parameters.rs index 9788b2b..37851fb 100644 --- a/examples/parameters.rs +++ b/examples/parameters.rs @@ -76,7 +76,7 @@ fn startup(mut commands: Commands, studio: Res) { }); // In this case only needed to show the controls: - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d::default()); } fn play_music(audio_sources: Query<&AudioSource>) { @@ -128,11 +128,11 @@ fn set_hour( } fn display_controls(mut commands: Commands) { - commands.spawn(TextBundle::from_sections([ - TextSection::from("Controls: \n"), - TextSection::from("Arrow Up: Increase Rain \n"), - TextSection::from("Arrow Down: Decrease Rain \n"), - TextSection::from("E: Change time to Evening \n"), - TextSection::from("M: Change time to Morning \n"), - ])); + commands.spawn(Text::default()).with_children(|parent| { + parent.spawn(TextSpan::new("Controls: \n")); + parent.spawn(TextSpan::new("Arrow Up: Increase Rain \n")); + parent.spawn(TextSpan::new("Arrow Down: Decrease Rain \n")); + parent.spawn(TextSpan::new("E: Change time to Evening \n")); + parent.spawn(TextSpan::new("M: Change time to Morning \n")); + }); } diff --git a/examples/spatial.rs b/examples/spatial.rs index 52342e5..883a6ed 100644 --- a/examples/spatial.rs +++ b/examples/spatial.rs @@ -33,30 +33,25 @@ fn setup_scene( studio: Res, ) { // Plane - commands.spawn(PbrBundle { - mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)), - material: materials.add(Color::srgb(0.3, 0.5, 0.3)), - transform: Transform::from_xyz(0.0, -1.0, 0.0), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))), + MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))), + Transform::from_xyz(0.0, -1.0, 0.0), + )); // Light - commands.spawn(PointLightBundle { - point_light: PointLight { + commands.spawn(( + PointLight { shadows_enabled: true, ..default() }, - transform: Transform::from_xyz(4.0, 8.0, 4.0), - ..default() - }); + Transform::from_xyz(4.0, 8.0, 4.0), + )); // Camera commands .spawn(SpatialListenerBundle::default()) - .insert(Camera3dBundle { - transform: Transform::from_xyz(0.0, 0.0, 4.0), - ..default() - }); + .insert((Camera3d::default(), Transform::from_xyz(0.0, 0.0, 4.0))); // Audio source: Orbiting cube let event_description = studio.get_event("event:/Music/Radio Station").unwrap(); @@ -68,12 +63,11 @@ fn setup_scene( commands .spawn(SpatialAudioBundle::from(audio_source)) - .insert(PbrBundle { - mesh: meshes.add(Cuboid::default()), - material: materials.add(Color::srgb(0.8, 0.7, 0.6)), - transform: Transform::from_scale(Vec3::splat(0.2)), - ..default() - }); + .insert(( + Mesh3d(meshes.add(Cuboid::default())), + MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))), + Transform::from_scale(Vec3::splat(0.2)), + )); } fn play_music(mut audio_sources: Query<&AudioSource>) { @@ -85,8 +79,8 @@ fn orbit_audio_source( mut audio_sources: Query<&mut Transform, With>, ) { for mut audio_source in audio_sources.iter_mut() { - audio_source.translation.x = time.elapsed_seconds().sin() * 2.0; - audio_source.translation.z = time.elapsed_seconds().cos() * 2.0; + audio_source.translation.x = time.elapsed_secs().sin() * 2.0; + audio_source.translation.z = time.elapsed_secs().cos() * 2.0; } } @@ -100,21 +94,19 @@ fn update_listener( let speed = 4.; if keyboard.pressed(KeyCode::ArrowRight) { - transform.translation.x += speed * time.delta_seconds(); + transform.translation.x += speed * time.delta_secs(); } if keyboard.pressed(KeyCode::ArrowLeft) { - transform.translation.x -= speed * time.delta_seconds(); + transform.translation.x -= speed * time.delta_secs(); } if keyboard.pressed(KeyCode::ArrowDown) { - transform.translation.z += speed * time.delta_seconds(); + transform.translation.z += speed * time.delta_secs(); } if keyboard.pressed(KeyCode::ArrowUp) { - transform.translation.z -= speed * time.delta_seconds(); + transform.translation.z -= speed * time.delta_secs(); } } fn display_controls(mut commands: Commands) { - commands.spawn(TextBundle::from( - "Controls: Use the arrow keys to move around", - )); + commands.spawn(Text::from("Controls: Use the arrow keys to move around")); } diff --git a/src/components/bundles.rs b/src/components/bundles.rs index ca050d9..df89dca 100644 --- a/src/components/bundles.rs +++ b/src/components/bundles.rs @@ -3,7 +3,7 @@ //! For more information on bundles, see the [`Bundle`] trait. use crate::prelude::{AudioListener, AudioSource, Velocity}; -use bevy::prelude::{Bundle, TransformBundle}; +use bevy::prelude::{Bundle, Transform}; use libfmod::{EventDescription, StopMode}; /// A bundle that includes all components required for emitting spatial audio. @@ -11,7 +11,7 @@ use libfmod::{EventDescription, StopMode}; pub struct SpatialAudioBundle { audio_source: AudioSource, velocity: Velocity, - transform: TransformBundle, + transform: Transform, } impl SpatialAudioBundle { @@ -33,7 +33,7 @@ impl SpatialAudioBundle { despawn_stop_mode: StopMode::AllowFadeout, }, velocity: Velocity::default(), - transform: TransformBundle::default(), + transform: Transform::default(), } } } @@ -43,7 +43,7 @@ impl From for SpatialAudioBundle { SpatialAudioBundle { audio_source: value, velocity: Velocity::default(), - transform: TransformBundle::default(), + transform: Transform::default(), } } } @@ -53,5 +53,5 @@ impl From for SpatialAudioBundle { pub struct SpatialListenerBundle { audio_listener: AudioListener, velocity: Velocity, - transform: TransformBundle, + transform: Transform, } diff --git a/src/components/velocity.rs b/src/components/velocity.rs index 3459838..ba87a6a 100644 --- a/src/components/velocity.rs +++ b/src/components/velocity.rs @@ -25,7 +25,7 @@ impl VelocityPlugin { mut last_delta: Local, ) { let delta_time = *last_delta; - *last_delta = time.delta_seconds(); + *last_delta = time.delta_secs(); if delta_time == 0.0 { return;