From 01342e4406f9f717f5e6a5fca1ab98f2c7144366 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. --- 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 dc4225db9b3844..8be2ae7a162886 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -602,12 +602,26 @@ impl Window { } } +/// Describes the information needed for a window creation like width, height, title, present_mode, etc. +/// This should be set up before adding the [`WindowPlugin`]. Most of these settings can also later +/// be configured through the [`Window`] resource. +/// +/// See `examples/window/window_settings.rs` for usage. +/// +/// [`Window`]: crate::Window +/// [`WindowPlugin`]: crate::WindowPlugin #[derive(Debug, Clone)] pub struct WindowDescriptor { + /// The requested logical width of the window's client area. pub width: f32, + /// The requested logical height of the window's client area. pub height: f32, + /// The position on the screen that the window will be placed on. pub position: Option, pub resize_constraints: WindowResizeConstraints, + /// Overrides the [`Window`]'s ratio of physical pixels to logical pixels + /// + /// [`Window`]: crate::Window pub scale_factor_override: Option, pub title: String, #[doc(alias = "vsync")] @@ -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, }