From 77d94a2b1f254158d6bcb056c60cc342054ef032 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Fri, 10 Nov 2023 16:06:49 +0100 Subject: [PATCH] Update to bevy 0.12 --- Cargo.toml | 24 +++++++++------ Makefile | 4 +-- Readme.md | 25 +++------------- assets/font.ttf | Bin 8640 -> 0 bytes examples/infinite_upgrades.rs | 23 ++++---------- examples/locking.rs | 2 +- examples/menu_navigation.rs | 2 +- examples/simple.rs | 2 +- examples/ultimate_menu_navigation.rs | 17 ++++++----- licenses/SIL Open Font License.txt | 43 --------------------------- src/dsl.rs | 3 +- src/events.rs | 4 +-- src/lib.rs | 12 ++++---- src/resolve.rs | 2 +- 14 files changed, 49 insertions(+), 114 deletions(-) delete mode 100644 assets/font.ttf delete mode 100644 licenses/SIL Open Font License.txt diff --git a/Cargo.toml b/Cargo.toml index d8d0bd1..99b64b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/nicopap/ui-navigation" homepage = "https://github.com/nicopap/ui-navigation" exclude = ["assets", ".github"] version = "0.32.0" -rust-version = "1.70" +rust-version = "1.73" edition = "2021" [features] @@ -21,18 +21,24 @@ pointer_focus = ["bevy_mod_picking"] cuicui_chirp = ["cuicui_dsl", "dep:cuicui_chirp"] [dependencies] -bevy = { version = "0.11", default-features = false, features = ["bevy_asset"] } -bevy_mod_picking = { version = "0.15.0", optional = true, default-features = false } -cuicui_chirp = { version = "0.10.0", optional = true, default-features = false, features = ["macros"] } -cuicui_dsl = { version = "0.10.0", optional = true } +bevy = { version = "0.12", default-features = false, features = ["bevy_asset"] } +bevy_mod_picking = { version = "0.17.0", optional = true, default-features = false } +cuicui_chirp = { version = "0.12.0", optional = true, default-features = false, features = ["macros"] } +cuicui_dsl = { version = "0.12.0", optional = true } non-empty-vec = { version = "0.2.2", default-features = false } [dev-dependencies] fastrand = "1.7" -cuicui_layout_bevy_ui = { version = "0.10.0", default-features = false } -cuicui_layout = { version = "0.10.0", default-features = false } -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "png", "x11", "default_font"] } +cuicui_layout_bevy_ui = { version = "0.12.0", default-features = false } +cuicui_layout = { version = "0.12.0", default-features = false } +bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "png", "x11", "default_font", "bevy_gilrs"] } + +[package.metadata.release] +pre-release-replacements = [ + {search="\\| 0.12 \\| [0-9.]* \\|",replace="| 0.12 | {{version}} |",file="Readme.md"}, + {search="bevy-ui-navigation = \"[0-9.]*\"",replace="bevy-ui-navigation = \"{{version}}\"",file="Readme.md"}, +] [[example]] name = "ultimate_menu_navigation" -required-features = ["cuicui_chirp", "bevy/filesystem_watcher", "cuicui_layout_bevy_ui/chirp", "cuicui_layout/reflect"] +required-features = ["cuicui_chirp", "cuicui_layout_bevy_ui/chirp"] diff --git a/Makefile b/Makefile index bbf6ec0..9d774d4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ check: cargo clippy --examples run: - cargo run --example ultimate_menu_navigation --features cuicui_dsl + cargo run --example ultimate_menu_navigation --features="cuicui_chirp cuicui_layout_bevy_ui/chirp" pre-hook: cargo fmt --all -- --check @@ -10,4 +10,4 @@ pre-hook: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features cargo clippy --all-features -- --deny clippy::all -D warnings cargo test --all-features - cargo clippy --all-features --features="cuicui_chirp bevy/filesystem_watcher cuicui_layout_bevy_ui/chirp cuicui_layout/reflect" --example ultimate_menu_navigation + cargo clippy --all-features --features="cuicui_chirp cuicui_layout_bevy_ui/chirp" --example ultimate_menu_navigation diff --git a/Readme.md b/Readme.md index a35a889..03d0dd7 100644 --- a/Readme.md +++ b/Readme.md @@ -581,6 +581,9 @@ fn return_trigger_action(mut requests: EventWriter, input: Res, input: Res, input: Res#N^^0EL)2)v}E%|hraS(-g<%9o}s<;&J4kEDgd)jM+~v%L0u@6RWD?wvb# z=FIP`b7n39LP#`OPgvsjRoB##Y!XR`{s6XWTHCF*-prvF34tDbUO2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I-vX~!gU7ozzyL#i)-wM;kt-KKwP*k#&4kRa9x7!gD4*m zp$>@?OQ;U$PaWYpgL(c;xXzLWvOQcEVV}$4x){HY(lc#JM?&JE0l$$hCCkWdIC7GV zBfdF2ugfAMC~qBpS1-U~BY9ZwB-7+(EKA7>yppP=%Wj*Q9G{reWsPL(Yy~!3p00EH z=INy?@Fnd#hxF#i6dA*Bdxh9EJvTWwH8zUX0Je>j<@jz0XC;BL@#RxPSgA$YbR50U zV2?2Yfdw(>h&znnMyjFqLgK(2g~KwBm((tuo~vCtGd`xXSqgM+L>8VM>xGVdE}sJa zzi@UTf*CT4d{A6E#8H5pP(1XHbdAl-PA;9+6%-U&3JS2{f9INNO!x(#N1Xrq2e=Di W1dU^qqxpsK#8Q3X7iIc{zyAiC=ro-G diff --git a/examples/infinite_upgrades.rs b/examples/infinite_upgrades.rs index 0bf8129..e0caeb0 100644 --- a/examples/infinite_upgrades.rs +++ b/examples/infinite_upgrades.rs @@ -50,7 +50,6 @@ fn main() { .add_systems(PostUpdate, mark_buttons) .add_systems(Startup, setup) // Our systems. - .init_resource::() .init_resource::() .run(); } @@ -134,15 +133,6 @@ impl MenuMap { } } -#[derive(Resource)] -struct MenuFont(Handle); -impl FromWorld for MenuFont { - fn from_world(world: &mut World) -> Self { - let assets = world.get_resource::().unwrap(); - MenuFont(assets.load("font.ttf")) - } -} - /// Animate anything. Used to move the camera smoothly. /// /// See the `animate_system` for how this is used. @@ -380,7 +370,7 @@ const QUALIFICATIVES: &[&str] = &[ // // === === === -fn setup(mut commands: Commands, font: Res, mut menus: ResMut) { +fn setup(mut commands: Commands, mut menus: ResMut) { let name = NAMES[fastrand::usize(0..NAMES.len())]; let upgrade = if fastrand::bool() { Upgrade::Roman(1) @@ -390,7 +380,7 @@ fn setup(mut commands: Commands, font: Res, mut menus: ResMut let weapon = Weapon::new(name, upgrade); commands.spawn((Camera2dBundle::default(), Animate::default())); let at = IVec2::ZERO; - let menu = spawn_weapon_upgrade_menu(&mut commands, at, &weapon, &font, None); + let menu = spawn_weapon_upgrade_menu(&mut commands, at, &weapon, None); menus.grid.insert(at, menu); } @@ -452,7 +442,7 @@ fn handle_menu_change( menu_position: Query<&GlobalTransform, With>, menu_query: Query<&ParentMenu>, ) { - for event in nav_events.iter() { + for event in nav_events.read() { if let NavEvent::FocusChanged { to, from } = event { let menu_query = (menu_query.get(*from.first()), menu_query.get(*to.first())); if let (Ok(from), Ok(to)) = menu_query { @@ -481,7 +471,7 @@ fn upgrade_weapon( mut commands: Commands, mut events: EventReader, mut requests: EventWriter, - (mut menus, time, font): (ResMut, Res