Struct bevy::window::WindowDescriptor
[−]pub struct WindowDescriptor {Show 15 fields
pub width: f32,
pub height: f32,
pub position: WindowPosition,
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_locked: bool,
pub mode: WindowMode,
pub transparent: bool,
pub canvas: Option<String>,
pub fit_canvas_to_parent: bool,
}
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.
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_locked: bool
Sets whether the window locks the cursor inside its borders when the window has focus.
mode: WindowMode
Sets the WindowMode
.
transparent: bool
Sets whether the background of the window should be transparent.
Platform-specific
- iOS / Android / Web: Unsupported.
- macOS X: Not working as expected.
- Windows 11: Not working as expected macOS X transparent works with winit out of the box, so this issue might be related to: https://github.com/gfx-rs/wgpu/issues/687 Windows 11 is related to https://github.com/rust-windowing/winit/issues/2082
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.
Trait Implementations
impl Clone for WindowDescriptor
impl Clone for WindowDescriptor
fn clone(&self) -> WindowDescriptor
fn clone(&self) -> WindowDescriptor
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 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
Returns the “default value” for a type. Read more
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 T where
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for T where
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
Return the T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
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>
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
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &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)
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
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using data from the given World
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more