Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bevy 0.14 #3

Merged
merged 6 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ 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 = { version = "0.0.12", 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",
"bevy_state",
"x11",
"default_font",
] }
Expand Down
10 changes: 6 additions & 4 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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]
Expand Down
7 changes: 4 additions & 3 deletions examples/simple_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{
};

use bevy::{
color::palettes::css::GREEN,
prelude::*,
winit::{UpdateMode::Continuous, WinitSettings},
};
Expand Down Expand Up @@ -75,7 +76,7 @@ impl SimpleBoxPlugin {
commands.spawn(PlayerBundle::new(
ClientId::SERVER,
Vec2::ZERO,
Color::GREEN,
GREEN.into(),
));
}
Cli::Server { port } => {
Expand Down Expand Up @@ -113,7 +114,7 @@ impl SimpleBoxPlugin {
commands.spawn(PlayerBundle::new(
ClientId::SERVER,
Vec2::ZERO,
Color::GREEN,
GREEN.into(),
));
}
Cli::Client { port, ip } => {
Expand Down Expand Up @@ -172,7 +173,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 } => {
Expand Down
12 changes: 6 additions & 6 deletions examples/tic_tac_toe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -378,7 +378,7 @@ impl TicTacToePlugin {
children: Query<&Children>,
mut pick_events: EventWriter<CellPick>,
) {
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 {
Expand Down Expand Up @@ -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),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<RepliconChannels>();
let channels = app.world().resource::<RepliconChannels>();
let connection_config = ConnectionConfig {
server_channels_config: channels.get_server_configs(),
client_channels_config: channels.get_client_configs(),
Expand Down
26 changes: 13 additions & 13 deletions tests/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ fn connect_disconnect() {

setup(&mut server_app, &mut client_app);

let mut renet_client = client_app.world.resource_mut::<RenetClient>();
let mut renet_client = client_app.world_mut().resource_mut::<RenetClient>();
assert!(renet_client.is_connected());
renet_client.disconnect();

client_app.update();
server_app.update();

let renet_server = server_app.world.resource::<RenetServer>();
let renet_server = server_app.world().resource::<RenetServer>();
assert_eq!(renet_server.connected_clients(), 0);

let connected_clients = server_app.world.resource::<ConnectedClients>();
let connected_clients = server_app.world().resource::<ConnectedClients>();
assert_eq!(connected_clients.len(), 0);

let replicon_client = client_app.world.resource_mut::<RepliconClient>();
let replicon_client = client_app.world_mut().resource_mut::<RepliconClient>();
assert!(replicon_client.is_disconnected());
}

Expand All @@ -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]
Expand All @@ -92,15 +92,15 @@ 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,
});

server_app.update();
client_app.update();

let dummy_events = client_app.world.resource::<Events<DummyEvent>>();
let dummy_events = client_app.world().resource::<Events<DummyEvent>>();
assert_eq!(dummy_events.len(), 1);
}

Expand All @@ -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::<Events<FromClient<DummyEvent>>>();
assert_eq!(client_events.len(), 1);
}
Expand All @@ -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::<RepliconChannels>();
let channels = app.world().resource::<RepliconChannels>();

let server_channels_config = channels.get_server_configs();
let client_channels_config = channels.get_client_configs();
Expand All @@ -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::<RepliconChannels>();
let channels = app.world().resource::<RepliconChannels>();

let server_channels_config = channels.get_server_configs();
let client_channels_config = channels.get_client_configs();
Expand Down Expand Up @@ -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::<RenetClient>().is_connected() {
if client_app.world().resource::<RenetClient>().is_connected() {
break;
}
}
Expand Down