diff --git a/examples/3d.rs b/examples/3d.rs index 9190a3a..ddcf635 100644 --- a/examples/3d.rs +++ b/examples/3d.rs @@ -45,29 +45,25 @@ fn setup( mut materials: ResMut>, ) { // 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)), - ..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))), + )); // light - commands.spawn(PointLightBundle { - point_light: PointLight { + commands.spawn(( + PointLight { intensity: 1500.0, 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(( - Camera3dBundle { - transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), - ..default() - }, + Camera3d::default(), + Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), Orbit::default(), )); @@ -77,16 +73,21 @@ fn setup( asset_server.load("spineboy/export/spineboy-pma.atlas"), ); let skeleton_handle = skeletons.add(skeleton); - commands.spawn(SpineBundle { - skeleton: skeleton_handle.clone(), - transform: Transform::from_xyz(0., 0., 0.).with_scale(Vec3::ONE * 0.005), - settings: SpineSettings { - default_materials: false, - mesh_type: SpineMeshType::Mesh3D, + commands.spawn(( + SpineLoader { + skeleton: skeleton_handle.clone(), ..Default::default() }, - ..Default::default() - }); + SpineBundle { + transform: Transform::from_xyz(0., 0., 0.).with_scale(Vec3::ONE * 0.005), + settings: SpineSettings { + default_materials: false, + mesh_type: SpineMeshType::Mesh3D, + ..Default::default() + }, + ..Default::default() + }, + )); } fn on_spawn( @@ -112,17 +113,17 @@ fn controls( ) { let mut window = window_query.single_mut(); if mouse_buttons.just_pressed(MouseButton::Left) { - window.cursor.grab_mode = CursorGrabMode::Locked; - window.cursor.visible = false; + window.cursor_options.grab_mode = CursorGrabMode::Locked; + window.cursor_options.visible = false; } if keys.just_pressed(KeyCode::Escape) { - window.cursor.grab_mode = CursorGrabMode::None; - window.cursor.visible = true; + window.cursor_options.grab_mode = CursorGrabMode::None; + window.cursor_options.visible = true; } let mut mouse_movement = Vec2::ZERO; for mouse_motion_event in mouse_motion_events.read() { - if window.cursor.grab_mode == CursorGrabMode::Locked { + if window.cursor_options.grab_mode == CursorGrabMode::Locked { mouse_movement += mouse_motion_event.delta; } } diff --git a/examples/crossfades.rs b/examples/crossfades.rs index 0500984..beea887 100644 --- a/examples/crossfades.rs +++ b/examples/crossfades.rs @@ -1,8 +1,5 @@ use bevy::prelude::*; -use bevy_spine::{ - Crossfades, SkeletonController, SkeletonData, Spine, SpineBundle, SpinePlugin, SpineReadyEvent, - SpineSet, SpineSystem, -}; +use bevy_spine::prelude::*; fn main() { App::new() @@ -23,7 +20,7 @@ fn setup( mut commands: Commands, mut skeletons: ResMut>, ) { - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d); let skeleton = SkeletonData::new_from_json( asset_server.load("spineboy/export/spineboy-pro.json"), @@ -35,14 +32,19 @@ fn setup( crossfades.add("idle", "walk", 0.5); crossfades.add("walk", "idle", 0.5); - commands.spawn(SpineBundle { - skeleton: skeleton_handle.clone(), - crossfades, - transform: Transform::default() - .with_translation(Vec3::new(0., -200., 0.)) - .with_scale(Vec3::ONE * 0.5), - ..Default::default() - }); + commands.spawn(( + SpineLoader { + skeleton: skeleton_handle.clone(), + ..Default::default() + }, + SpineBundle { + crossfades, + transform: Transform::default() + .with_translation(Vec3::new(0., -200., 0.)) + .with_scale(Vec3::ONE * 0.5), + ..Default::default() + }, + )); } fn on_spawn( @@ -68,7 +70,7 @@ fn crossfades(mut spine_query: Query<&mut Spine>, time: Res