From 89654632aeb5316406b6b2a402710de1e64f5168 Mon Sep 17 00:00:00 2001 From: Julia Naomi Date: Wed, 6 Dec 2023 14:14:01 -0600 Subject: [PATCH] set-bevy-inspector-as-dev --- Cargo.toml | 4 +++- src/debug_diagnostic.rs | 5 +++-- src/player.rs | 4 ++-- src/safe_area.rs | 12 ++++++------ src/sheep.rs | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0667618..a120108 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,9 @@ lto = "thin" [features] dev = [ "bevy/dynamic_linking", + "dep:bevy-inspector-egui" ] +default = ["dev"] # All of Bevy's default features exept for the audio related ones (bevy_audio, vorbis), since they clash with bevy_kira_audio # and android_shared_stdcxx, since that is covered in `mobile` @@ -63,7 +65,7 @@ webbrowser = { version = "0.8", features = ["hardened"] } winit = { version = "0.28.7", default-features = false } image = { version = "0.24", default-features = false } bevy_egui = "0.23.0" -bevy-inspector-egui = "0.21.0" +bevy-inspector-egui = {version = "0.21.0", optional = true } [build-dependencies] embed-resource = "1.4" diff --git a/src/debug_diagnostic.rs b/src/debug_diagnostic.rs index 230810f..4bedda7 100644 --- a/src/debug_diagnostic.rs +++ b/src/debug_diagnostic.rs @@ -18,8 +18,9 @@ impl Plugin for DiagnosticPlugin { ) .chain(), ) - .add_systems(Update, (fps_counting, sheep_counter_text)) - .add_plugins(bevy_inspector_egui::quick::WorldInspectorPlugin::default()); + .add_systems(Update, (fps_counting, sheep_counter_text)); + # [cfg(feature = "dev")] + app.add_plugins(bevy_inspector_egui::quick::WorldInspectorPlugin::default()); } } diff --git a/src/player.rs b/src/player.rs index 188c8ad..404550c 100644 --- a/src/player.rs +++ b/src/player.rs @@ -1,4 +1,4 @@ -use bevy::{input::mouse::MouseWheel, pbr::ExtendedMaterial, prelude::*, window::PrimaryWindow}; +use bevy::{input::mouse::MouseWheel, prelude::*, window::PrimaryWindow}; use crate::{ get_sprite_rotation, @@ -75,7 +75,7 @@ fn spawn_player_by_event( mut event_reader: EventReader, asset_server: Res, mut meshes: ResMut>, - mut materials: ResMut>, + _materials: ResMut>, mut sprite_material: ResMut>, ) { for event in event_reader.read() { diff --git a/src/safe_area.rs b/src/safe_area.rs index 0af01b6..43bf693 100644 --- a/src/safe_area.rs +++ b/src/safe_area.rs @@ -33,7 +33,7 @@ impl SafeArea { dx.abs() < size.x / 2.0 && dy.abs() < size.y / 2.0 } - SafeArea::Ellipse { pos1, pos2, radius } => { + SafeArea::Ellipse { pos1, pos2, radius: _ } => { let d = (*pos1 - *pos2).length(); let r = (*pos1 - sheep_pos).length(); r * r <= d * d @@ -43,8 +43,8 @@ impl SafeArea { pub fn get_center(&self) -> Vec3 { match self { - SafeArea::Rect { pos, size } => Vec3::new(pos.x, 0.0, pos.y), - SafeArea::Ellipse { pos1, pos2, radius } => { + SafeArea::Rect { pos, size: _ } => Vec3::new(pos.x, 0.0, pos.y), + SafeArea::Ellipse { pos1, pos2, radius: _ } => { Vec3::new((pos1.x + pos2.x) / 2.0, 0.0, (pos1.y + pos2.y) / 2.0) } } @@ -62,7 +62,7 @@ fn draw_safe_area(mut gizmos: Gizmos, query: Query<&SafeArea>) { Color::GREEN, ); } - SafeArea::Ellipse { pos1, pos2, radius } => {} + SafeArea::Ellipse { pos1: _, pos2: _, radius: _ } => {} } } } @@ -73,8 +73,8 @@ pub struct SheepCounter { } fn count_sheeps( - mut safe_areas: Query<&SafeArea>, - mut sheep: Query<&Transform, With>, + safe_areas: Query<&SafeArea>, + sheep: Query<&Transform, With>, mut counter: ResMut, ) { let mut count = 0; diff --git a/src/sheep.rs b/src/sheep.rs index a77f30a..055c158 100644 --- a/src/sheep.rs +++ b/src/sheep.rs @@ -77,7 +77,7 @@ pub fn update_scared_sheeps( time: Res