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

Sets whether the window is resizable.

Platform-specific

  • iOS / Android / Web: Unsupported.
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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert 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
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Creates Self using data from the given World
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more