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

improve documentation relating to WindowPlugin and Window #9173

Merged
merged 3 commits into from
Jul 30, 2023
Merged
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 crates/bevy_window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ 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`].
/// `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`].
pub primary_window: Option<Window>,

/// Whether to exit the app when there are no open windows.
Expand Down
13 changes: 7 additions & 6 deletions crates/bevy_window/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 [`primary_window`](crate::WindowPlugin::primary_window)
/// is `Some`.
#[derive(Default, Debug, Component, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Reflect)]
#[reflect(Component)]
pub struct PrimaryWindow;
Expand Down Expand Up @@ -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);
}
Expand Down