From faf3a62fe9734233bef28f340b43e792af7fef94 Mon Sep 17 00:00:00 2001 From: Hrafn Orri Hrafnkelsson Date: Thu, 11 Jul 2024 14:09:50 +0000 Subject: [PATCH 1/6] update to bevy 0.14 --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d6576af..be53d6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,14 @@ license = "MIT OR Apache-2.0" include = ["/src", "/tests", "LICENSE*"] [dependencies] -bevy_replicon = { version = "0.26" } -bevy_renet = { version = "0.0.11", default-features = false } -bevy = { version = "0.13", default-features = false } +bevy_replicon = { version = "0.27" } +bevy_renet = { git = "https://github.com/raffaeleragni/renet", rev = "f36762ca7cf338300159be6206c191928a019f41", default-features = false } +bevy = { version = "0.14", default-features = false } [dev-dependencies] serde = "1.0" clap = { version = "4.1", features = ["derive"] } -bevy = { version = "0.13", default-features = false, features = [ +bevy = { version = "0.14", default-features = false, features = [ "bevy_text", "bevy_ui", "bevy_gizmos", From 5409b3b76a607870af05d4090492ed0f2e9ef242 Mon Sep 17 00:00:00 2001 From: Hrafn Orri Hrafnkelsson Date: Thu, 11 Jul 2024 17:55:16 +0000 Subject: [PATCH 2/6] 0.14 --- Cargo.toml | 1 + examples/simple_box.rs | 4 ++-- src/lib.rs | 2 +- tests/transport.rs | 26 +++++++++++++------------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index be53d6c..cd7174e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ bevy = { version = "0.14", default-features = false, features = [ "bevy_text", "bevy_ui", "bevy_gizmos", + "bevy_state", "x11", "default_font", ] } diff --git a/examples/simple_box.rs b/examples/simple_box.rs index 2c2e69c..e8ba882 100644 --- a/examples/simple_box.rs +++ b/examples/simple_box.rs @@ -75,7 +75,7 @@ impl SimpleBoxPlugin { commands.spawn(PlayerBundle::new( ClientId::SERVER, Vec2::ZERO, - Color::GREEN, + Color::linear_rgb(0.0, 1.0, 0.0), )); } Cli::Server { port } => { @@ -113,7 +113,7 @@ impl SimpleBoxPlugin { commands.spawn(PlayerBundle::new( ClientId::SERVER, Vec2::ZERO, - Color::GREEN, + Color::linear_rgb(0.0, 1.0, 0.0), )); } Cli::Client { port, ip } => { diff --git a/src/lib.rs b/src/lib.rs index b031a01..b7d6604 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,7 @@ use bevy_replicon_renet::{renet::ConnectionConfig, RenetChannelsExt, RepliconRen # let mut app = App::new(); # app.add_plugins(RepliconPlugins); -let channels = app.world.resource::(); +let channels = app.world().resource::(); let connection_config = ConnectionConfig { server_channels_config: channels.get_server_configs(), client_channels_config: channels.get_client_configs(), diff --git a/tests/transport.rs b/tests/transport.rs index fa8bbf8..97dae41 100644 --- a/tests/transport.rs +++ b/tests/transport.rs @@ -32,20 +32,20 @@ fn connect_disconnect() { setup(&mut server_app, &mut client_app); - let mut renet_client = client_app.world.resource_mut::(); + let mut renet_client = client_app.world_mut().resource_mut::(); assert!(renet_client.is_connected()); renet_client.disconnect(); client_app.update(); server_app.update(); - let renet_server = server_app.world.resource::(); + let renet_server = server_app.world().resource::(); assert_eq!(renet_server.connected_clients(), 0); - let connected_clients = server_app.world.resource::(); + let connected_clients = server_app.world().resource::(); assert_eq!(connected_clients.len(), 0); - let replicon_client = client_app.world.resource_mut::(); + let replicon_client = client_app.world_mut().resource_mut::(); assert!(replicon_client.is_disconnected()); } @@ -66,12 +66,12 @@ fn replication() { setup(&mut server_app, &mut client_app); - server_app.world.spawn(Replicated); + server_app.world_mut().spawn(Replicated); server_app.update(); client_app.update(); - assert_eq!(client_app.world.entities().len(), 1); + assert_eq!(client_app.world().entities().len(), 1); } #[test] @@ -92,7 +92,7 @@ fn server_event() { setup(&mut server_app, &mut client_app); - server_app.world.send_event(ToClients { + server_app.world_mut().send_event(ToClients { mode: SendMode::Broadcast, event: DummyEvent, }); @@ -100,7 +100,7 @@ fn server_event() { server_app.update(); client_app.update(); - let dummy_events = client_app.world.resource::>(); + let dummy_events = client_app.world().resource::>(); assert_eq!(dummy_events.len(), 1); } @@ -122,13 +122,13 @@ fn client_event() { setup(&mut server_app, &mut client_app); - client_app.world.send_event(DummyEvent); + client_app.world_mut().send_event(DummyEvent); client_app.update(); server_app.update(); let client_events = server_app - .world + .world_mut() .resource::>>(); assert_eq!(client_events.len(), 1); } @@ -141,7 +141,7 @@ fn setup(server_app: &mut App, client_app: &mut App) { } fn setup_client(app: &mut App, client_id: u64, port: u16) { - let channels = app.world.resource::(); + let channels = app.world().resource::(); let server_channels_config = channels.get_server_configs(); let client_channels_config = channels.get_client_configs(); @@ -157,7 +157,7 @@ fn setup_client(app: &mut App, client_id: u64, port: u16) { } fn setup_server(app: &mut App, max_clients: usize) -> u16 { - let channels = app.world.resource::(); + let channels = app.world().resource::(); let server_channels_config = channels.get_server_configs(); let client_channels_config = channels.get_client_configs(); @@ -218,7 +218,7 @@ fn wait_for_connection(server_app: &mut App, client_app: &mut App) { loop { client_app.update(); server_app.update(); - if client_app.world.resource::().is_connected() { + if client_app.world().resource::().is_connected() { break; } } From d2db4a183328030f816d25f003c08f3f6f1f3859 Mon Sep 17 00:00:00 2001 From: Hrafn Orri Hrafnkelsson Date: Thu, 11 Jul 2024 17:58:03 +0000 Subject: [PATCH 3/6] use srgb --- examples/simple_box.rs | 2 +- examples/tic_tac_toe.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/simple_box.rs b/examples/simple_box.rs index e8ba882..b1bb492 100644 --- a/examples/simple_box.rs +++ b/examples/simple_box.rs @@ -172,7 +172,7 @@ impl SimpleBoxPlugin { commands.spawn(PlayerBundle::new( *client_id, Vec2::ZERO, - Color::rgb(r, g, b), + Color::srgb(r, g, b), )); } ServerEvent::ClientDisconnected { client_id, reason } => { diff --git a/examples/tic_tac_toe.rs b/examples/tic_tac_toe.rs index 5aba126..06f05f8 100644 --- a/examples/tic_tac_toe.rs +++ b/examples/tic_tac_toe.rs @@ -92,7 +92,7 @@ impl Plugin for TicTacToePlugin { const GRID_SIZE: usize = 3; -const BACKGROUND_COLOR: Color = Color::rgb(0.9, 0.9, 0.9); +const BACKGROUND_COLOR: Color = Color::srgb(0.9, 0.9, 0.9); const PROTOCOL_ID: u64 = 0; @@ -110,7 +110,7 @@ impl TicTacToePlugin { const LINE_THICKNESS: f32 = 10.0; const BOARD_SIZE: f32 = CELL_SIZE * GRID_SIZE as f32 + LINES_COUNT as f32 * LINE_THICKNESS; - const BOARD_COLOR: Color = Color::rgb(0.8, 0.8, 0.8); + const BOARD_COLOR: Color = Color::srgb(0.8, 0.8, 0.8); for line in 0..LINES_COUNT { let position = -BOARD_SIZE / 2.0 @@ -149,7 +149,7 @@ impl TicTacToePlugin { const BUTTON_SIZE: f32 = CELL_SIZE / 1.2; const BUTTON_MARGIN: f32 = (CELL_SIZE + LINE_THICKNESS - BUTTON_SIZE) / 2.0; - const TEXT_COLOR: Color = Color::rgb(0.5, 0.5, 1.0); + const TEXT_COLOR: Color = Color::srgb(0.5, 0.5, 1.0); const FONT_SIZE: f32 = 40.0; commands @@ -378,7 +378,7 @@ impl TicTacToePlugin { children: Query<&Children>, mut pick_events: EventWriter, ) { - const HOVER_COLOR: Color = Color::rgb(0.85, 0.85, 0.85); + const HOVER_COLOR: Color = Color::srgb(0.85, 0.85, 0.85); for (button_entity, button_parent, interaction, mut background) in &mut buttons { match interaction { @@ -599,8 +599,8 @@ impl Symbol { fn color(self) -> Color { match self { - Symbol::Cross => Color::rgb(1.0, 0.5, 0.5), - Symbol::Nought => Color::rgb(0.5, 0.5, 1.0), + Symbol::Cross => Color::srgb(1.0, 0.5, 0.5), + Symbol::Nought => Color::srgb(0.5, 0.5, 1.0), } } From 93f4eb86eda4ee716ea20ab0df9cf282f4084c02 Mon Sep 17 00:00:00 2001 From: Hrafn Orri Hrafnkelsson Date: Thu, 11 Jul 2024 18:05:08 +0000 Subject: [PATCH 4/6] use green --- examples/simple_box.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/simple_box.rs b/examples/simple_box.rs index b1bb492..f80fb4b 100644 --- a/examples/simple_box.rs +++ b/examples/simple_box.rs @@ -8,6 +8,7 @@ use std::{ }; use bevy::{ + color::palettes::css::GREEN, prelude::*, winit::{UpdateMode::Continuous, WinitSettings}, }; @@ -75,7 +76,7 @@ impl SimpleBoxPlugin { commands.spawn(PlayerBundle::new( ClientId::SERVER, Vec2::ZERO, - Color::linear_rgb(0.0, 1.0, 0.0), + GREEN.into(), )); } Cli::Server { port } => { @@ -113,7 +114,7 @@ impl SimpleBoxPlugin { commands.spawn(PlayerBundle::new( ClientId::SERVER, Vec2::ZERO, - Color::linear_rgb(0.0, 1.0, 0.0), + GREEN.into(), )); } Cli::Client { port, ip } => { From 0dc131da8a5e9dd7cfd646644dae10d44520f250 Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Sat, 20 Jul 2024 20:51:45 +0300 Subject: [PATCH 5/6] Bump bevy_renet to 0.0.12 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cd7174e..9b88680 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ include = ["/src", "/tests", "LICENSE*"] [dependencies] bevy_replicon = { version = "0.27" } -bevy_renet = { git = "https://github.com/raffaeleragni/renet", rev = "f36762ca7cf338300159be6206c191928a019f41", default-features = false } +bevy_renet = { version = "0.0.12", default-features = false } bevy = { version = "0.14", default-features = false } [dev-dependencies] From 0b29b6bc615abf71bf5f6a8248a9ed3a78d237a4 Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Sat, 20 Jul 2024 21:38:29 +0300 Subject: [PATCH 6/6] Update deny.toml --- deny.toml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deny.toml b/deny.toml index 8bfe849..441b2f0 100644 --- a/deny.toml +++ b/deny.toml @@ -16,18 +16,19 @@ multiple-versions = "deny" wildcards = "allow" skip = [ { name = "bitflags", version = "2.0" }, + { name = "cfg_aliases", version = "0.1" }, { name = "event-listener", version = "<5.0" }, { name = "event-listener-strategy", version = "0.5" }, + { name = "fixedbitset", version = "0.4" }, { name = "libloading", version = "0.7" }, - { name = "objc-sys", version = "0.2.0-beta.2" }, - { name = "objc2", version = "0.3.0-beta.3.patch-leaks.3" }, - { name = "objc2-encode", version = "2.0.0-pre.2" }, + { name = "ndk-sys", version = "0.5" }, { name = "redox_syscall", version = "<0.5" }, { name = "regex-automata", version = "0.1" }, { name = "regex-syntax", version = "0.6" }, { name = "syn", version = "1.0" }, - { name = "tracing-log", version = "0.1" }, + { name = "toml_edit", version = "0.21" }, { name = "windows" }, + { name = "windows-core" }, { name = "windows-sys" }, { name = "windows-targets" }, { name = "windows_aarch64_gnullvm" }, @@ -37,6 +38,7 @@ skip = [ { name = "windows_x86_64_gnu" }, { name = "windows_x86_64_gnullvm" }, { name = "windows_x86_64_msvc" }, + { name = "winnow", version = "0.5" }, ] [sources]