Struct ggez::conf::WindowMode
source · pub struct WindowMode {Show 14 fields
pub width: f32,
pub height: f32,
pub maximized: bool,
pub fullscreen_type: FullscreenType,
pub borderless: bool,
pub transparent: bool,
pub min_width: f32,
pub min_height: f32,
pub max_width: f32,
pub max_height: f32,
pub resizable: bool,
pub visible: bool,
pub resize_on_scale_factor_change: bool,
pub logical_size: Option<LogicalSize<f32>>,
}
Expand description
A builder structure containing window settings
that can be set at runtime and changed with graphics::set_mode()
.
Defaults:
WindowMode {
width: 800.0,
height: 600.0,
maximized: false,
fullscreen_type: FullscreenType::Windowed,
borderless: false,
min_width: 1.0,
max_width: 0.0,
min_height: 1.0,
max_height: 0.0,
resizable: false,
visible: true,
transparent: false,
resize_on_scale_factor_change: false,
logical_size: None,
}
Fields§
§width: f32
Window width in physical pixels
height: f32
Window height in physical pixels
maximized: bool
Whether or not to maximize the window
fullscreen_type: FullscreenType
Fullscreen type
borderless: bool
Whether or not to show window decorations
transparent: bool
Whether or not the window should be transparent
min_width: f32
Minimum width for resizable windows; 1 is the technical minimum, as wgpu will panic on a width of 0.
min_height: f32
Minimum height for resizable windows; 1 is the technical minimum, as wgpu will panic on a height of 0.
max_width: f32
Maximum width for resizable windows; 0 means no limit
max_height: f32
Maximum height for resizable windows; 0 means no limit
resizable: bool
Whether or not the window is resizable
visible: bool
Whether this window should displayed (true) or hidden (false)
resize_on_scale_factor_change: bool
Whether this window should change its size in physical pixels
when its hidpi factor changes, i.e. when WindowEvent::ScaleFactorChanged
is fired.
You usually want this to be false, since the window suddenly changing size may break your game. Setting this to true may be desirable if you plan for it and want your window to behave like windows of other programs when being dragged from one screen to another, for example.
For more context on this take a look at this conversation.
logical_size: Option<LogicalSize<f32>>
Window height/width but allows LogicalSize for high DPI systems. If Some will be used instead of width/height.
Implementations§
source§impl WindowMode
impl WindowMode
sourcepub fn dimensions(self, width: f32, height: f32) -> Self
pub fn dimensions(self, width: f32, height: f32) -> Self
Set default window size, or screen resolution in true fullscreen mode.
sourcepub fn fullscreen_type(self, fullscreen_type: FullscreenType) -> Self
pub fn fullscreen_type(self, fullscreen_type: FullscreenType) -> Self
Set the fullscreen type.
sourcepub fn borderless(self, borderless: bool) -> Self
pub fn borderless(self, borderless: bool) -> Self
Set whether a window should be borderless in windowed mode.
sourcepub fn transparent(self, transparent: bool) -> Self
pub fn transparent(self, transparent: bool) -> Self
Set whether a window should be transparent.
sourcepub fn min_dimensions(self, width: f32, height: f32) -> Self
pub fn min_dimensions(self, width: f32, height: f32) -> Self
Set minimum window dimensions for windowed mode. Minimum dimensions will always be >= 1.
sourcepub fn max_dimensions(self, width: f32, height: f32) -> Self
pub fn max_dimensions(self, width: f32, height: f32) -> Self
Set maximum window dimensions for windowed mode.
sourcepub fn resize_on_scale_factor_change(
self,
resize_on_scale_factor_change: bool
) -> Self
pub fn resize_on_scale_factor_change( self, resize_on_scale_factor_change: bool ) -> Self
Set whether to resize when the hidpi factor changes
Trait Implementations§
source§impl Clone for WindowMode
impl Clone for WindowMode
source§fn clone(&self) -> WindowMode
fn clone(&self) -> WindowMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WindowMode
impl Debug for WindowMode
source§impl Default for WindowMode
impl Default for WindowMode
source§fn default() -> Self
fn default() -> Self
Return WindowMode { width: 800.0, height: 600.0, maximized: false, fullscreen_type: FullscreenType :: Windowed, borderless: false, transparent: false, min_width: 1.0, min_height: 1.0, max_width: 0.0, max_height: 0.0, resizable: false, visible: true, resize_on_scale_factor_change: false, logical_size: None }
source§impl<'de> Deserialize<'de> for WindowMode
impl<'de> Deserialize<'de> for WindowMode
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl PartialEq<WindowMode> for WindowMode
impl PartialEq<WindowMode> for WindowMode
source§fn eq(&self, other: &WindowMode) -> bool
fn eq(&self, other: &WindowMode) -> bool
self
and other
values to be equal, and is used
by ==
.