Skip to content

Commit

Permalink
Remove inspect feature
Browse files Browse the repository at this point in the history
bevy-inspector-egui now works perfectly fine through Reflect, so no need
to also derive inspector options when we don't use any of its
annotations.
  • Loading branch information
johanhelsing committed Nov 2, 2023
1 parent 853d23f commit e223345
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,21 @@ rust-version = "1.67.0"

[[example]]
name = "simple"
required-features = ["inspect"]

[[example]]
name = "multiple"
required-features = ["inspect"]

[features]
default = ["serialize"]
inspect = ["bevy-inspector-egui"]
serialize = ["serde"]

[dependencies]
bevy = { version = "0.11", default-features = false, features = [
"bevy_render",
"bevy_ui"
] }
bevy-inspector-egui = { version = "0.19", optional = true }
serde = { version = "^1", features = ["derive"], optional = true }

[dev-dependencies]
bevy = "0.11"
bevy = "0.11"
bevy-inspector-egui = "0.20"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ Aviable and compatible versions
- [Multiple Joysticks Desktop](./examples/multiple.rs)

# Features
- inspect: for world inspect with egui inspector

- serialize (default): for serialization support for all types (usable for save and load settings)

```toml
virtual_joystick = {
version = "*",
default-features = false,
features = [ "inspect", "serialize" ]
features = [ "serialize" ]
}
```

Expand All @@ -60,7 +60,7 @@ Check out the [examples](./examples) for details.

```sh
# to run example
cargo run --example simple -F=inspect
cargo run --example simple
```

Add to Cargo.toml
Expand Down
6 changes: 0 additions & 6 deletions src/behaviour.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use bevy::prelude::*;

#[cfg(feature = "inspect")]
use bevy_inspector_egui::prelude::*;
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};

#[derive(Reflect, Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "inspect", derive(InspectorOptions))]
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "inspect", reflect(InspectorOptions))]
pub enum VirtualJoystickAxis {
#[default]
Both,
Expand Down Expand Up @@ -39,9 +35,7 @@ impl VirtualJoystickAxis {
}

#[derive(Reflect, Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "inspect", derive(InspectorOptions))]
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "inspect", reflect(InspectorOptions))]
pub enum VirtualJoystickType {
/// Static position
Fixed,
Expand Down
7 changes: 0 additions & 7 deletions src/joystick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ use bevy::{
},
};

#[cfg(feature = "inspect")]
use bevy_inspector_egui::prelude::*;

use crate::{VirtualJoystickAxis, VirtualJoystickType};

/// The tint color of the image
Expand All @@ -20,8 +17,6 @@ use crate::{VirtualJoystickAxis, VirtualJoystickType};
/// respecting transparent areas.
#[derive(Component, Copy, Clone, Debug, Reflect)]
#[reflect(Component, Default)]
#[cfg_attr(feature = "inspect", derive(InspectorOptions))]
#[cfg_attr(feature = "inspect", reflect(InspectorOptions))]
pub struct TintColor(pub Color);

impl TintColor {
Expand All @@ -42,8 +37,6 @@ impl From<Color> for TintColor {

#[derive(Component, Copy, Clone, Debug, Default, Reflect)]
#[reflect(Component, Default)]
#[cfg_attr(feature = "inspect", derive(InspectorOptions))]
#[cfg_attr(feature = "inspect", reflect(InspectorOptions))]
pub struct VirtualJoystickInteractionArea;

#[derive(Bundle, Debug, Default)]
Expand Down

0 comments on commit e223345

Please sign in to comment.