Skip to content
Snippets Groups Projects
Unverified Commit d113ef7c authored by ActuallyHappening's avatar ActuallyHappening Committed by GitHub
Browse files

add: documents feature flags (#147)

* add: documents feature flags
esspecially the multicam feature

* doc: documents requirement for `CosmicPrimaryCamera`

* add: `CosmicPrimaryCamera` implements Debug and Default
for convenience

* fix: lints fixed
parent 4066c696
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -11,6 +11,8 @@ keywords = ["bevy"] ...@@ -11,6 +11,8 @@ keywords = ["bevy"]
exclude = ["assets/*"] exclude = ["assets/*"]
[features] [features]
## Enable to avoid panicing when multiple cameras are used in the same world
## Requires you to add `CosmicPrimaryCamera` marker component to the primary camera
multicam = [] multicam = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...@@ -36,6 +38,8 @@ unicode-segmentation = { version = "1.11.0" } ...@@ -36,6 +38,8 @@ unicode-segmentation = { version = "1.11.0" }
crossbeam-channel = "0.5.8" crossbeam-channel = "0.5.8"
image = "0.24.6" image = "0.24.6"
sys-locale = "0.3.0" sys-locale = "0.3.0"
document-features = "0.2.8"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
arboard = "3.2.0" arboard = "3.2.0"
......
...@@ -74,6 +74,9 @@ ...@@ -74,6 +74,9 @@
//! | 0.12.* | 0.15 | //! | 0.12.* | 0.15 |
//! | 0.11.* | 0.8 - 0.14 | //! | 0.11.* | 0.8 - 0.14 |
//! //!
//! ## Feature flags
#![doc = document_features::document_features!()]
//!
//! ## License //! ## License
//! //!
//! MIT or Apache-2.0 //! MIT or Apache-2.0
...@@ -148,8 +151,37 @@ impl Plugin for CosmicEditPlugin { ...@@ -148,8 +151,37 @@ impl Plugin for CosmicEditPlugin {
} }
} }
/// Attach to primary camera, and enable the `multicam` feature to use multiple cameras.
/// Will panic if no `Camera`s without this component exist and the `multicam` feature is enabled.
///
/// A very basic example which doesn't panic:
/// ```rust
/// use bevy::prelude::*;
/// use bevy_cosmic_edit::CosmicPrimaryCamera;
///
/// fn main() {
/// App::new()
/// .add_plugins((
/// DefaultPlugins,
/// bevy_cosmic_edit::CosmicEditPlugin::default(),
/// ))
/// .add_systems(Startup, setup)
/// .run();
/// }
///
/// fn setup(mut commands: Commands) {
/// commands.spawn((Camera3dBundle::default(), CosmicPrimaryCamera));
/// commands.spawn(Camera3dBundle {
/// camera: Camera {
/// order: 2,
/// ..default()
/// },
/// ..default()
/// });
/// }
/// ```
#[cfg(feature = "multicam")] #[cfg(feature = "multicam")]
#[derive(Component)] #[derive(Component, Debug, Default)]
pub struct CosmicPrimaryCamera; pub struct CosmicPrimaryCamera;
/// Resource struct that holds configuration options for cosmic fonts. /// Resource struct that holds configuration options for cosmic fonts.
......
...@@ -10,7 +10,7 @@ impl Plugin for UserSelectPlugin { ...@@ -10,7 +10,7 @@ impl Plugin for UserSelectPlugin {
} }
/// Tag component to disable user selection /// Tag component to disable user selection
/// Like CSS `user-select: none` https://developer.mozilla.org/en-US/docs/Web/CSS/user-select /// Like CSS `user-select: none` <https://developer.mozilla.org/en-US/docs/Web/CSS/user-select>
#[derive(Component, Default)] #[derive(Component, Default)]
pub struct UserSelectNone; pub struct UserSelectNone;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment