From a1e1770cf1ff9383628a3574b4139f7760e8c1a7 Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Mon, 16 May 2022 14:59:43 +0300 Subject: [PATCH] Add documentation to the WindowDescriptor struct. Co-Authored-By: Alice Cecile --- crates/bevy_window/src/window.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index dc4225db9b384..a8f00d699bbe6 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -602,17 +602,31 @@ impl Window { } } +/// Describes the information needed for a window creation. +/// +/// This should be set up before adding the [`WindowPlugin`](crate::WindowPlugin). Most of these settings can also later +/// be configured through the [`Window`](crate::Window) resource. +/// +/// See [`examples/window/window_settings.rs`](https://github.com/bevyengine/bevy/blob/latest/examples/window/window_settings.rs) for usage. #[derive(Debug, Clone)] pub struct WindowDescriptor { + /// The requested logical width of the window's client area. + /// May vary from the physical width due to different pixel density on different monitors. pub width: f32, + /// The requested logical height of the window's client area. + /// May vary from the physical height due to different pixel density on different monitors. pub height: f32, + /// The position on the screen that the window will be centered at. + /// If set to `None`, some platform-specific position will be chosen. pub position: Option, pub resize_constraints: WindowResizeConstraints, + /// Overrides the [`Window`](crate::Window)'s ratio of physical pixels to logical pixels. pub scale_factor_override: Option, pub title: String, #[doc(alias = "vsync")] pub present_mode: PresentMode, pub resizable: bool, + /// Sets whether the window should have borders and bars. pub decorations: bool, pub cursor_visible: bool, pub cursor_locked: bool, @@ -625,6 +639,8 @@ pub struct WindowDescriptor { /// macOS X transparent works with winit out of the box, so this issue might be related to: /// Windows 11 is related to pub transparent: bool, + /// A string that represents a DOM query selector for the target canvas element. + /// Use this in case you want to create the canvas element yourself. #[cfg(target_arch = "wasm32")] pub canvas: Option, }