From 4956b0697b535390cc83044018441bc4485a56af Mon Sep 17 00:00:00 2001 From: Adam Mizerski Date: Mon, 10 Jul 2023 20:51:01 +0200 Subject: [PATCH] update to bevy 0.11 --- Cargo.toml | 6 +++--- README.md | 11 ++++++----- examples/basic.rs | 4 ++-- examples/key_bindings.rs | 4 ++-- examples/scroll.rs | 12 ++++++------ src/lib.rs | 22 +++++++++++----------- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 400a91a..ef5b636 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_flycam" -version = "0.10.1" +version = "0.11.0" authors = ["Spencer Burris "] edition = "2021" license = "ISC" @@ -13,7 +13,7 @@ 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.10", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] } +bevy = { version = "0.11", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] } [dev-dependencies] -bevy = { version = "0.10", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"] } +bevy = { version = "0.11", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"] } diff --git a/README.md b/README.md index 9abae1d..a871fe6 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.10 +A basic first-person fly camera for Bevy 0.11 ## Controls @@ -29,7 +29,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc ```toml [dependencies] - bevy = "0.10" + bevy = "0.11" bevy_flycam = "*" ``` @@ -37,7 +37,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc ```toml [dependencies] - bevy = "0.10" + bevy = "0.11" bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" } ``` @@ -57,7 +57,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc fn main() { App::new() .add_plugins(DefaultPlugins) - .add_plugin(PlayerPlugin) + .add_plugins(PlayerPlugin) .run(); } ``` @@ -75,7 +75,7 @@ Same thing goes for the keybindings used for moving the camera. fn main() { App::new() .add_plugins(DefaultPlugins) - .add_plugin(PlayerPlugin) + .add_plugins(PlayerPlugin) .insert_resource(MovementSettings { sensitivity: 0.00015, // default: 0.00012 speed: 12.0, // default: 12.0 @@ -96,6 +96,7 @@ fn main() { bevy_flycam's crate version follows bevy's minor version as shown: | bevy | bevy_flycam | | :-- | :-- | +| `0.11.0` | `0.11.0` | | `0.10.1` | `0.10.1` | ## Contributing diff --git a/examples/basic.rs b/examples/basic.rs index cd526e6..7ef9e44 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -8,12 +8,12 @@ fn main() { App::new() .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) - .add_plugin(PlayerPlugin) + .add_plugins(PlayerPlugin) .insert_resource(MovementSettings { sensitivity: 0.00015, // default: 0.00012 speed: 12.0, // default: 12.0 }) - .add_system(setup.on_startup()) + .add_systems(Startup, setup) .run(); } diff --git a/examples/key_bindings.rs b/examples/key_bindings.rs index 5d893ba..6887447 100644 --- a/examples/key_bindings.rs +++ b/examples/key_bindings.rs @@ -8,7 +8,7 @@ fn main() { App::new() .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) - .add_plugin(PlayerPlugin) + .add_plugins(PlayerPlugin) .insert_resource(MovementSettings { sensitivity: 0.00015, // default: 0.00012 speed: 12.0, // default: 12.0 @@ -19,7 +19,7 @@ fn main() { move_descend: KeyCode::Q, ..Default::default() }) - .add_startup_system(setup) + .add_systems(Startup, setup) .run(); } diff --git a/examples/scroll.rs b/examples/scroll.rs index bc06ca2..4617875 100644 --- a/examples/scroll.rs +++ b/examples/scroll.rs @@ -16,15 +16,15 @@ fn main() { .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) //NoCameraPlayerPlugin as we provide the camera - .add_plugin(NoCameraPlayerPlugin) + .add_plugins(NoCameraPlayerPlugin) .insert_resource(MovementSettings { ..Default::default() }) // Setting initial state .add_state::() - .add_system(setup.on_startup()) - .add_system(switch_scroll_type) - .add_system(scroll) + .add_systems(Startup, setup) + .add_systems(Update, switch_scroll_type) + .add_systems(Update, scroll) .run(); } @@ -78,7 +78,7 @@ fn switch_scroll_type( keyboard_input: Res>, ) { if keyboard_input.just_pressed(KeyCode::Z) { - let result = match scroll_type.0 { + let result = match scroll_type.get() { ScrollType::MovementSpeed => ScrollType::Zoom, ScrollType::Zoom => ScrollType::MovementSpeed, }; @@ -96,7 +96,7 @@ fn scroll( mut query: Query<(&FlyCam, &mut Projection)>, ) { for event in mouse_wheel_events.iter() { - if scroll_type.0 == ScrollType::MovementSpeed { + if *scroll_type.get() == ScrollType::MovementSpeed { settings.speed = (settings.speed + event.y * 0.1).abs(); println!("Speed: {:?}", settings.speed); } else { diff --git a/src/lib.rs b/src/lib.rs index 8166851..e7d47ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,7 +49,7 @@ impl Default for KeyBindings { move_left: KeyCode::A, move_right: KeyCode::D, move_ascend: KeyCode::Space, - move_descend: KeyCode::LShift, + move_descend: KeyCode::ShiftLeft, toggle_grab_cursor: KeyCode::Escape, } } @@ -212,11 +212,11 @@ impl Plugin for PlayerPlugin { app.init_resource::() .init_resource::() .init_resource::() - .add_system(setup_player.on_startup()) - .add_system(initial_grab_cursor.on_startup()) - .add_system(player_move) - .add_system(player_look) - .add_system(cursor_grab); + .add_systems(Startup, setup_player) + .add_systems(Startup, initial_grab_cursor) + .add_systems(Update, player_move) + .add_systems(Update, player_look) + .add_systems(Update, cursor_grab); } } @@ -227,10 +227,10 @@ impl Plugin for NoCameraPlayerPlugin { app.init_resource::() .init_resource::() .init_resource::() - .add_system(initial_grab_cursor.on_startup()) - .add_system(initial_grab_on_flycam_spawn.on_startup()) - .add_system(player_move) - .add_system(player_look) - .add_system(cursor_grab); + .add_systems(Startup, initial_grab_cursor) + .add_systems(Startup, initial_grab_on_flycam_spawn) + .add_systems(Update, player_move) + .add_systems(Update, player_look) + .add_systems(Update, cursor_grab); } }