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

Remove inspector feature #11

Closed
Closed
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
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +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" }
bevy-inspector-egui = { version = "0.19", optional = true }
bevy = { version = "0.11", default-features = false, features = [
"bevy_render",
"bevy_ui"
] }
serde = { version = "^1", features = ["derive"], optional = true }

[dev-dependencies]
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))]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could remove this part since, as you say, it now takes advantage of the reflect, but I don't think we should remove the feature

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what's the point of the feature if it doesn't do anything?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid having too many dependencies when compiling in development and give the freedom to choose what to use. Think that compiling in Rust already takes too much time to have to compile things that I don't need, for example, not everyone needs to have the type inspection of this library and when they need it they just add the feature :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's a development-only feature? I still don't see for this would be useful for users of the crate, though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not everyone needs to have the type inspection of this library and when they need it they just add the feature :D

You understand that users of this crate won't get the dev-dependencies, even while they're developing, right?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You understand that users of this crate won't get the dev-dependencies, even while they're developing, right?

Yes, but precisely controlling the dependencies through the features allows them to choose in which environment they want to have it available, there will be those who want it in production, those who want it in development and those who do not want it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what does the feature do for them? They can't use it without also adding bevy-inspector-egui to their dependencies or dev-dependencies section? It does nothing except increase build times?

#[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
Loading