diff --git a/Cargo.toml b/Cargo.toml index b4cd03a..cffb42a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_flycam" -version = "0.12.0" +version = "0.13.0" authors = ["Spencer Burris "] edition = "2021" license = "ISC" @@ -13,7 +13,20 @@ categories = ["game-engines", "game-development"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] } +bevy = { version = "0.13", default-features = false, features = [ + "bevy_render", + "bevy_core_pipeline", + "bevy_asset", +] } [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset", "ktx2", "zstd", "tonemapping_luts"] } +bevy = { version = "0.13", default-features = false, features = [ + "x11", + "wayland", + "bevy_pbr", + "bevy_core_pipeline", + "bevy_asset", + "ktx2", + "zstd", + "tonemapping_luts", +] } diff --git a/README.md b/README.md index a02e4b1..f18cea2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Crates.io](https://img.shields.io/crates/l/bevy_flycam) ![docs.rs](https://img.shields.io/docsrs/bevy_flycam) -A basic first-person fly camera for Bevy 0.12 +A basic first-person fly camera for Bevy 0.13 ## Controls @@ -29,7 +29,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc ```toml [dependencies] - bevy = "0.11" + bevy = "0.13" bevy_flycam = "*" ``` @@ -37,7 +37,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc ```toml [dependencies] - bevy = "0.11" + bevy = "0.13" bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" } ``` @@ -123,6 +123,7 @@ fn setup(mut commands: Commands) { bevy_flycam's crate version follows bevy's minor version as shown: | bevy | bevy_flycam | | :-- | :-- | +| `0.13.0` | `0.13.0` | | `0.12.0` | `0.12.0` | | `0.11.0` | `0.11.0` | | `0.10.1` | `0.10.1` | diff --git a/examples/basic.rs b/examples/basic.rs index 7ef9e44..80da279 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -25,18 +25,15 @@ fn setup( ) { // plane commands.spawn((PbrBundle { - mesh: meshes.add(Mesh::from(shape::Plane { - size: 5.0, - ..Default::default() - })), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + mesh: meshes.add(Plane3d::new(Vec3::Y).mesh().size(5.0, 5.0)), + material: materials.add(Color::rgb(0.3, 0.5, 0.3)), ..Default::default() },)); // cube commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), - material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), + mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), + material: materials.add(Color::rgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..Default::default() }); diff --git a/examples/key_bindings.rs b/examples/key_bindings.rs index 6887447..404ffc3 100644 --- a/examples/key_bindings.rs +++ b/examples/key_bindings.rs @@ -15,8 +15,8 @@ fn main() { }) // Unreal movement layout .insert_resource(KeyBindings { - move_ascend: KeyCode::E, - move_descend: KeyCode::Q, + move_ascend: KeyCode::KeyE, + move_descend: KeyCode::KeyQ, ..Default::default() }) .add_systems(Startup, setup) @@ -31,18 +31,15 @@ fn setup( ) { // plane commands.spawn((PbrBundle { - mesh: meshes.add(Mesh::from(shape::Plane { - size: 5.0, - ..Default::default() - })), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + mesh: meshes.add(Plane3d::new(Vec3::Y).mesh().size(5.0, 5.0)), + material: materials.add(Color::rgb(0.3, 0.5, 0.3)), ..Default::default() },)); // cube commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), - material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), + mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), + material: materials.add(Color::rgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..Default::default() }); diff --git a/examples/scroll.rs b/examples/scroll.rs index 4617875..014665e 100644 --- a/examples/scroll.rs +++ b/examples/scroll.rs @@ -21,7 +21,7 @@ fn main() { ..Default::default() }) // Setting initial state - .add_state::() + .init_state::() .add_systems(Startup, setup) .add_systems(Update, switch_scroll_type) .add_systems(Update, scroll) @@ -36,18 +36,15 @@ fn setup( ) { // plane commands.spawn((PbrBundle { - mesh: meshes.add(Mesh::from(shape::Plane { - size: 5.0, - ..Default::default() - })), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + mesh: meshes.add(Plane3d::new(Vec3::Y).mesh().size(5.0, 5.0)), + material: materials.add(Color::rgb(0.3, 0.5, 0.3)), ..Default::default() },)); // cube commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), - material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), + mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), + material: materials.add(Color::rgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..Default::default() }); @@ -75,9 +72,9 @@ fn setup( fn switch_scroll_type( scroll_type: Res>, mut next_scroll_type: ResMut>, - keyboard_input: Res>, + keyboard_input: Res>, ) { - if keyboard_input.just_pressed(KeyCode::Z) { + if keyboard_input.just_pressed(KeyCode::KeyZ) { let result = match scroll_type.get() { ScrollType::MovementSpeed => ScrollType::Zoom, ScrollType::Zoom => ScrollType::MovementSpeed, @@ -95,7 +92,7 @@ fn scroll( mut mouse_wheel_events: EventReader, mut query: Query<(&FlyCam, &mut Projection)>, ) { - for event in mouse_wheel_events.iter() { + for event in mouse_wheel_events.read() { if *scroll_type.get() == ScrollType::MovementSpeed { settings.speed = (settings.speed + event.y * 0.1).abs(); println!("Speed: {:?}", settings.speed); diff --git a/src/lib.rs b/src/lib.rs index 4d4d1b3..15c5b7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,10 +44,10 @@ pub struct KeyBindings { impl Default for KeyBindings { fn default() -> Self { Self { - move_forward: KeyCode::W, - move_backward: KeyCode::S, - move_left: KeyCode::A, - move_right: KeyCode::D, + move_forward: KeyCode::KeyW, + move_backward: KeyCode::KeyS, + move_left: KeyCode::KeyA, + move_right: KeyCode::KeyD, move_ascend: KeyCode::Space, move_descend: KeyCode::ShiftLeft, toggle_grab_cursor: KeyCode::Escape, @@ -96,7 +96,7 @@ fn setup_player(mut commands: Commands) { /// Handles keyboard input and movement fn player_move( - keys: Res>, + keys: Res>, time: Res