pub struct Window {Show 19 fields
pub cursor: Cursor,
pub present_mode: PresentMode,
pub mode: WindowMode,
pub position: WindowPosition,
pub resolution: WindowResolution,
pub title: String,
pub composite_alpha_mode: CompositeAlphaMode,
pub resize_constraints: WindowResizeConstraints,
pub resizable: bool,
pub decorations: bool,
pub transparent: bool,
pub focused: bool,
pub window_level: WindowLevel,
pub canvas: Option<String>,
pub fit_canvas_to_parent: bool,
pub prevent_default_event_handling: bool,
pub internal: InternalWindowState,
pub ime_enabled: bool,
pub ime_position: Vec2,
}
Expand description
Define how a window will be created and how it will behave.
Fields§
§cursor: Cursor
The cursor of this window.
present_mode: PresentMode
What presentation mode to give the window.
mode: WindowMode
Which fullscreen or windowing mode should be used?
position: WindowPosition
Where the window should be placed.
resolution: WindowResolution
What resolution the window should have.
title: String
Stores the title of the window.
composite_alpha_mode: CompositeAlphaMode
How the alpha channel of textures should be handled while compositing.
resize_constraints: WindowResizeConstraints
Which size limits to give the window.
resizable: bool
Should the window be resizable?
Note: This does not stop the program from fullscreening/setting the size programmatically.
decorations: bool
Should the window have decorations enabled?
(Decorations are the minimize, maximize, and close buttons on desktop apps)
transparent: bool
Should the window be transparent?
Defines whether the background of the window should be transparent.
Platform-specific
- iOS / Android / Web: Unsupported.
- macOS X: 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.
You should also set the window composite_alpha_mode
to CompositeAlphaMode::PostMultiplied
.
focused: bool
Should the window start focused?
window_level: WindowLevel
Should the window always be on top of other windows?
Platform-specific
- iOS / Android / Web / Wayland: Unsupported.
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.
prevent_default_event_handling: bool
Whether or not to stop events from propagating out of the canvas element
When true
, this will prevent common browser hotkeys like F5, F12, Ctrl+R, tab, etc.
from performing their default behavior while the bevy app has focus.
This value has no effect on non-web platforms.
internal: InternalWindowState
Stores internal state that isn’t directly accessible.
ime_enabled: bool
Should the window use Input Method Editor?
If enabled, the window will receive Ime
events instead of
ReceivedCharacter
or
KeyboardInput
.
IME should be enabled during text input, but not when you expect to get the exact key pressed.
Platform-specific
- iOS / Android / Web: Unsupported.
ime_position: Vec2
Sets location of IME candidate box in client area coordinates relative to the top left.
Platform-specific
- iOS / Android / Web: Unsupported.
Implementations§
§impl Window
impl Window
pub fn set_maximized(&mut self, maximized: bool)
pub fn set_maximized(&mut self, maximized: bool)
Setting this to true will attempt to maximize the window.
Setting it to false will attempt to un-maximize the window.
pub fn set_minimized(&mut self, minimized: bool)
pub fn set_minimized(&mut self, minimized: bool)
Setting this to true will attempt to minimize the window.
Setting it to false will attempt to un-minimize the window.
pub fn physical_width(&self) -> u32
pub fn physical_width(&self) -> u32
The window’s client area width in physical pixels.
pub fn physical_height(&self) -> u32
pub fn physical_height(&self) -> u32
The window’s client area height in physical pixels.
pub fn scale_factor(&self) -> f64
pub fn scale_factor(&self) -> f64
The window’s scale factor.
pub fn cursor_position(&self) -> Option<Vec2>
pub fn cursor_position(&self) -> Option<Vec2>
The cursor position in this window
pub fn physical_cursor_position(&self) -> Option<Vec2>
pub fn physical_cursor_position(&self) -> Option<Vec2>
The physical cursor position in this window
pub fn set_cursor_position(&mut self, position: Option<Vec2>)
pub fn set_cursor_position(&mut self, position: Option<Vec2>)
Set the cursor position in this window
pub fn set_physical_cursor_position(&mut self, position: Option<DVec2>)
pub fn set_physical_cursor_position(&mut self, position: Option<DVec2>)
Set the physical cursor position in this window
Trait Implementations§
§impl FromReflect for Windowwhere
Cursor: FromReflect,
PresentMode: FromReflect,
WindowMode: FromReflect,
WindowPosition: FromReflect,
WindowResolution: FromReflect,
String: FromReflect,
CompositeAlphaMode: FromReflect,
WindowResizeConstraints: FromReflect,
bool: FromReflect,
WindowLevel: FromReflect,
Option<String>: FromReflect,
InternalWindowState: FromReflect,
Vec2: FromReflect,
impl FromReflect for Windowwhere Cursor: FromReflect, PresentMode: FromReflect, WindowMode: FromReflect, WindowPosition: FromReflect, WindowResolution: FromReflect, String: FromReflect, CompositeAlphaMode: FromReflect, WindowResizeConstraints: FromReflect, bool: FromReflect, WindowLevel: FromReflect, Option<String>: FromReflect, InternalWindowState: FromReflect, Vec2: FromReflect,
§fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<Window>
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<Window>
Self
from a reflected value.§impl GetTypeRegistration for Windowwhere
Cursor: Reflect,
PresentMode: Reflect,
WindowMode: Reflect,
WindowPosition: Reflect,
WindowResolution: Reflect,
String: Reflect,
CompositeAlphaMode: Reflect,
WindowResizeConstraints: Reflect,
bool: Reflect,
WindowLevel: Reflect,
Option<String>: Reflect,
InternalWindowState: Reflect,
Vec2: Reflect,
impl GetTypeRegistration for Windowwhere Cursor: Reflect, PresentMode: Reflect, WindowMode: Reflect, WindowPosition: Reflect, WindowResolution: Reflect, String: Reflect, CompositeAlphaMode: Reflect, WindowResizeConstraints: Reflect, bool: Reflect, WindowLevel: Reflect, Option<String>: Reflect, InternalWindowState: Reflect, Vec2: Reflect,
§impl Reflect for Windowwhere
Cursor: Reflect,
PresentMode: Reflect,
WindowMode: Reflect,
WindowPosition: Reflect,
WindowResolution: Reflect,
String: Reflect,
CompositeAlphaMode: Reflect,
WindowResizeConstraints: Reflect,
bool: Reflect,
WindowLevel: Reflect,
Option<String>: Reflect,
InternalWindowState: Reflect,
Vec2: Reflect,
impl Reflect for Windowwhere Cursor: Reflect, PresentMode: Reflect, WindowMode: Reflect, WindowPosition: Reflect, WindowResolution: Reflect, String: Reflect, CompositeAlphaMode: Reflect, WindowResizeConstraints: Reflect, bool: Reflect, WindowLevel: Reflect, Option<String>: Reflect, InternalWindowState: Reflect, Vec2: Reflect,
§fn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
§fn into_any(self: Box<Window, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<Window, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Any>
.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.§fn into_reflect(self: Box<Window, Global>) -> Box<dyn Reflect + 'static, Global>
fn into_reflect(self: Box<Window, Global>) -> Box<dyn Reflect + 'static, Global>
§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
§fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
Reflect
trait object. Read more§fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn set( &mut self, value: Box<dyn Reflect + 'static, Global> ) -> Result<(), Box<dyn Reflect + 'static, Global>>
§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
§fn reflect_owned(self: Box<Window, Global>) -> ReflectOwned
fn reflect_owned(self: Box<Window, Global>) -> ReflectOwned
§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
§impl Struct for Windowwhere
Cursor: Reflect,
PresentMode: Reflect,
WindowMode: Reflect,
WindowPosition: Reflect,
WindowResolution: Reflect,
String: Reflect,
CompositeAlphaMode: Reflect,
WindowResizeConstraints: Reflect,
bool: Reflect,
WindowLevel: Reflect,
Option<String>: Reflect,
InternalWindowState: Reflect,
Vec2: Reflect,
impl Struct for Windowwhere Cursor: Reflect, PresentMode: Reflect, WindowMode: Reflect, WindowPosition: Reflect, WindowResolution: Reflect, String: Reflect, CompositeAlphaMode: Reflect, WindowResizeConstraints: Reflect, bool: Reflect, WindowLevel: Reflect, Option<String>: Reflect, InternalWindowState: Reflect, Vec2: Reflect,
§fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>
name
as a &dyn Reflect
.§fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>
fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>
name
as a
&mut dyn Reflect
.§fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
index
as a
&dyn Reflect
.§fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
index
as a &mut dyn Reflect
.§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct
.§impl Typed for Windowwhere
Cursor: Reflect,
PresentMode: Reflect,
WindowMode: Reflect,
WindowPosition: Reflect,
WindowResolution: Reflect,
String: Reflect,
CompositeAlphaMode: Reflect,
WindowResizeConstraints: Reflect,
bool: Reflect,
WindowLevel: Reflect,
Option<String>: Reflect,
InternalWindowState: Reflect,
Vec2: Reflect,
impl Typed for Windowwhere Cursor: Reflect, PresentMode: Reflect, WindowMode: Reflect, WindowPosition: Reflect, WindowResolution: Reflect, String: Reflect, CompositeAlphaMode: Reflect, WindowResizeConstraints: Reflect, bool: Reflect, WindowLevel: Reflect, Option<String>: Reflect, InternalWindowState: Reflect, Vec2: Reflect,
Auto Trait Implementations§
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
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.§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§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
.§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
.§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.§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.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§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§impl<T> GetPath for Twhere
T: Reflect,
impl<T> GetPath for Twhere T: Reflect,
§fn reflect_path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'r, 'p>( &'r self, path: &'p str ) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn reflect_path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'r, 'p>( &'r mut self, path: &'p str ) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more