Struct bevy::window::prelude::WindowDescriptor
pub struct WindowDescriptor {Show 17 fields
pub width: f32,
pub height: f32,
pub position: WindowPosition,
pub monitor: MonitorSelection,
pub resize_constraints: WindowResizeConstraints,
pub scale_factor_override: Option<f64>,
pub title: String,
pub present_mode: PresentMode,
pub resizable: bool,
pub decorations: bool,
pub cursor_visible: bool,
pub cursor_grab_mode: CursorGrabMode,
pub mode: WindowMode,
pub transparent: bool,
pub canvas: Option<String>,
pub fit_canvas_to_parent: bool,
pub alpha_mode: CompositeAlphaMode,
}
Expand description
Describes the information needed for creating a window.
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.
Fields§
§width: f32
The requested logical width of the window’s client area.
May vary from the physical width due to different pixel density on different monitors.
height: 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.
position: WindowPosition
The position on the screen that the window will be placed at.
The monitor to place the window on can be selected with the monitor
field.
Ignored if mode
is set to something other than WindowMode::Windowed
WindowPosition::Automatic
will be overridden with WindowPosition::At(Vec2::ZERO)
if a specific monitor is selected.
monitor: MonitorSelection
The monitor to place the window on.
resize_constraints: WindowResizeConstraints
Sets minimum and maximum resize limits.
scale_factor_override: Option<f64>
Overrides the window’s ratio of physical pixels to logical pixels.
If there are some scaling problems on X11 try to set this option to Some(1.0)
.
title: String
Sets the title that displays on the window top bar, on the system task bar and other OS specific places.
Platform-specific
- Web: Unsupported.
present_mode: PresentMode
Controls when a frame is presented to the screen.
The window’s PresentMode
.
Used to select whether or not VSync is used
resizable: bool
§decorations: bool
Sets whether the window should have borders and bars.
cursor_visible: bool
Sets whether the cursor is visible when the window has focus.
cursor_grab_mode: CursorGrabMode
Sets whether and how the window grabs the cursor.
mode: WindowMode
Sets the WindowMode
.
The monitor to go fullscreen on can be selected with the monitor
field.
transparent: bool
Sets whether the background of the window should be transparent.
Platform-specific
- iOS / Android / Web: Unsupported.
- macOS: Not working as expected. See Bevy #6330.
- Linux (Wayland): Not working as expected. See Bevy #5779.
canvas: Option<String>
The “html canvas” element selector.
If set, this selector will be used to find a matching html canvas element, rather than creating a new one. Uses the CSS selector format.
This value has no effect on non-web platforms.
fit_canvas_to_parent: bool
Whether or not to fit the canvas element’s size to its parent element’s size.
Warning: this will not behave as expected for parents that set their size according to the size of their children. This creates a “feedback loop” that will result in the canvas growing on each resize. When using this feature, ensure the parent’s size is not affected by its children.
This value has no effect on non-web platforms.
alpha_mode: CompositeAlphaMode
Specifies how the alpha channel of the textures should be handled during compositing.
Trait Implementations§
§impl Clone for WindowDescriptor
impl Clone for WindowDescriptor
§fn clone(&self) -> WindowDescriptor
fn clone(&self) -> WindowDescriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for WindowDescriptor
impl Debug for WindowDescriptor
§impl Default for WindowDescriptor
impl Default for WindowDescriptor
§fn default() -> WindowDescriptor
fn default() -> WindowDescriptor
§impl PartialEq<WindowDescriptor> for WindowDescriptor
impl PartialEq<WindowDescriptor> for WindowDescriptor
§fn eq(&self, other: &WindowDescriptor) -> bool
fn eq(&self, other: &WindowDescriptor) -> bool
impl StructuralPartialEq for WindowDescriptor
Auto Trait Implementations§
impl RefUnwindSafe for WindowDescriptor
impl Send for WindowDescriptor
impl Sync for WindowDescriptor
impl Unpin for WindowDescriptor
impl UnwindSafe for WindowDescriptor
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist. Read more§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World