Skip to content

Commit

Permalink
Improve documentation (TheBevyFlock#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Biscardi <[email protected]>
Co-authored-by: Ben Frankel <[email protected]>
  • Loading branch information
3 people authored Jul 18, 2024
1 parent 48e2af3 commit a98e5cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ fn spawn_camera(mut commands: Commands) {
commands.spawn((
Name::new("Camera"),
Camera2dBundle::default(),
// Render all UI to this camera.
// Not strictly necessary since we only use one camera,
// but if we don't use this component, our UI will disappear as soon
// as we add another camera. This includes indirect ways of adding cameras like using
// [ui node outlines](https://bevyengine.org/news/bevy-0-14/#ui-node-outline-gizmos)
// for debugging. So it's good to have this here for future-proofing.
IsDefaultUiCamera,
));
}
3 changes: 3 additions & 0 deletions src/ui/widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ impl Containers for Commands<'_, '_> {
}

/// An internal trait for types that can spawn entities.
/// This is here so that [`Widgets`] can be implemented on all types that
/// are able to spawn entities.
/// Ideally, this trait should be [part of Bevy itself](https://github.com/bevyengine/bevy/issues/14231).
trait Spawn {
fn spawn<B: Bundle>(&mut self, bundle: B) -> EntityCommands;
}
Expand Down

0 comments on commit a98e5cb

Please sign in to comment.