From c7658e7c5fe4a4c5a3e5110a427ad9c463e5aa94 Mon Sep 17 00:00:00 2001 From: Jordan Ellis Coppard Date: Sun, 16 Jul 2023 20:35:34 +1000 Subject: [PATCH 1/3] change WindowPlugin and Window documentation - attempt to clarify with better docstrings the default behaviour of WindowPlugin and the component type it accepts. --- crates/bevy_window/src/lib.rs | 12 +++++++----- crates/bevy_window/src/window.rs | 13 +++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 3ae1c083c8f2e..3760558f38366 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -38,12 +38,14 @@ impl Default for WindowPlugin { /// A [`Plugin`] that defines an interface for windowing support in Bevy. pub struct WindowPlugin { - /// Settings for the primary window. This will be spawned by - /// default, with the marker component [`PrimaryWindow`](PrimaryWindow). - /// If you want to run without a primary window you should set this to `None`. + /// Settings for the primary window. /// - /// Note that if there are no windows, by default the App will exit, - /// due to [`exit_on_all_closed`]. + /// By default [`WindowPlugin::primary_window`] resolves to `Some` + /// which spawns marker component [`PrimaryWindow`](PrimaryWindow). + /// To run without a primary window set [`WindowPlugin::primary_window`] to `None`. + /// + /// Note that if there are no windows the App will exit (by default) due to + /// [`exit_on_all_closed`]. pub primary_window: Option, /// Whether to exit the app when there are no open windows. diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index b5135751845f1..5014451c60b78 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -16,8 +16,9 @@ use crate::CursorIcon; /// /// Currently this is assumed to only exist on 1 entity at a time. /// -/// [`WindowPlugin`](crate::WindowPlugin) will spawn a window entity -/// with this component if `primary_window` is `Some`. +/// [`WindowPlugin`](crate::WindowPlugin) will spawn a [`Window`] entity +/// with this component if [`WindowPlugin`](crate::WindowPlugin::primary_window) +/// is `Some`. #[derive(Default, Debug, Component, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Reflect)] #[reflect(Component)] pub struct PrimaryWindow; @@ -234,16 +235,16 @@ impl Default for Window { } impl Window { - /// Setting this to true will attempt to maximize the window. + /// Setting to true will attempt to maximize the window. /// - /// Setting it to false will attempt to un-maximize the window. + /// Setting to false will attempt to un-maximize the window. pub fn set_maximized(&mut self, maximized: bool) { self.internal.maximize_request = Some(maximized); } - /// Setting this to true will attempt to minimize the window. + /// Setting to true will attempt to minimize the window. /// - /// Setting it to false will attempt to un-minimize the window. + /// Setting to false will attempt to un-minimize the window. pub fn set_minimized(&mut self, minimized: bool) { self.internal.minimize_request = Some(minimized); } From ce476c2a8423c46d46b75bad7a6d3752bfbccbf5 Mon Sep 17 00:00:00 2001 From: Jordan Ellis Coppard Date: Tue, 18 Jul 2023 21:56:09 +0800 Subject: [PATCH 2/3] apply pr feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sélène Amanita <134181069+Selene-Amanita@users.noreply.github.com> --- crates/bevy_window/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 3760558f38366..79d15d724e737 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -40,9 +40,10 @@ impl Default for WindowPlugin { pub struct WindowPlugin { /// Settings for the primary window. /// - /// By default [`WindowPlugin::primary_window`] resolves to `Some` - /// which spawns marker component [`PrimaryWindow`](PrimaryWindow). - /// To run without a primary window set [`WindowPlugin::primary_window`] to `None`. + /// `Some(custom_window)` will spawn an entity with `custom_window` and [`PrimaryWindow`] as components. + /// `None` will not spawn a primary window. + /// + /// Defaults to `Some(Window::default())`. /// /// Note that if there are no windows the App will exit (by default) due to /// [`exit_on_all_closed`]. From cba5c7271286c38a889865aa00f96b7573131f77 Mon Sep 17 00:00:00 2001 From: Jordan Ellis Coppard Date: Tue, 18 Jul 2023 21:56:31 +0800 Subject: [PATCH 3/3] apply pr feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sélène Amanita <134181069+Selene-Amanita@users.noreply.github.com> --- crates/bevy_window/src/window.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 5014451c60b78..b1206f272dace 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -17,7 +17,7 @@ use crate::CursorIcon; /// Currently this is assumed to only exist on 1 entity at a time. /// /// [`WindowPlugin`](crate::WindowPlugin) will spawn a [`Window`] entity -/// with this component if [`WindowPlugin`](crate::WindowPlugin::primary_window) +/// with this component if [`primary_window`](crate::WindowPlugin::primary_window) /// is `Some`. #[derive(Default, Debug, Component, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Reflect)] #[reflect(Component)]