WindowConfig

Struct WindowConfig 

Source
pub struct WindowConfig {
Show 23 fields pub title: String, pub width: u32, pub height: u32, pub fullscreen: bool, pub min_size: Option<(u32, u32)>, pub max_size: Option<(u32, u32)>, pub position: Option<(i32, i32)>, pub maximized: bool, pub resizable: bool, pub vsync: bool, pub multisampling: u8, pub high_dpi: bool, pub lazy_loop: bool, pub transparent: bool, pub always_on_top: bool, pub decorations: bool, pub visible: bool, pub mouse_passthrough: bool, pub app_id: String, pub window_icon_path: Option<PathBuf>, pub window_icon_data: Option<&'static [u8]>, pub taskbar_icon_path: Option<PathBuf>, pub taskbar_icon_data: Option<&'static [u8]>,
}
Expand description

Builder configuration for the window options

Fields§

§title: String

Window’s title Web: no-op

§width: u32

Window’s width

§height: u32

Window’s height

§fullscreen: bool

Start window in fullscreen mode Web: no-op

§min_size: Option<(u32, u32)>

Minimum resizable window’s size

§max_size: Option<(u32, u32)>

Maximum resizable window’s size

§position: Option<(i32, i32)>

Window’s x/y start position

§maximized: bool

Start the window maximized Web: The canvas will fill the size of the parent of the HtmlCanvasElement

§resizable: bool

Allow to resize the window Web: The canvas will resize along with the parent of the HtmlCanvasElement

§vsync: bool

Enable V-Sync Web: no-op

§multisampling: u8

Sets multisampling Setting to 0 disables multisampling

§high_dpi: bool

Enable High DPI viewport and drawing if the device pixel ratio is higher than 1 This is false by default, enable it could consume more resources and require a custom way of drawing things. The advice is using it if you know what you’re doing

§lazy_loop: bool

Inner loop will run only after an input event

§transparent: bool

Background as transparent

§always_on_top: bool

Window will be drawn above others

§decorations: bool

Enable decorations Web: Does nothing

§visible: bool

Hide the windows

§mouse_passthrough: bool§app_id: String

App ID On Web use or create the canvas with this id.

§window_icon_path: Option<PathBuf>

Optinal Window icon filepath

§window_icon_data: Option<&'static [u8]>

Optinal Window icon filedata

§taskbar_icon_path: Option<PathBuf>

Optinal Task bar icon filepath

§taskbar_icon_data: Option<&'static [u8]>

Optinal Task bar icon filedata

Implementations§

Source§

impl WindowConfig

Source

pub fn new() -> Self

Create a new instance using default values

Source

pub fn set_title(self, title: &str) -> Self

Sets the window’s title

Source

pub fn set_lazy_loop(self, lazy: bool) -> Self

Inner loop will run only after an input event

Source

pub fn set_size(self, width: u32, height: u32) -> Self

Sets the window’s width and height

Source

pub fn set_fullscreen(self, fullscreen: bool) -> Self

Enable fullscreen mode

Source

pub fn set_min_size(self, width: u32, height: u32) -> Self

Sets the window’s minimum size

Source

pub fn set_max_size(self, width: u32, height: u32) -> Self

Sets the window’s maximum size

Source

pub fn set_position(self, x: i32, y: i32) -> Self

Sets the window’s x and y

Source

pub fn set_maximized(self, maximized: bool) -> Self

Starts the window maximized

Source

pub fn set_resizable(self, resizable: bool) -> Self

Allow the window to be resizable

Source

pub fn set_vsync(self, vsync: bool) -> Self

Enable vsync

Source

pub fn set_multisampling(self, samples: u8) -> Self

Sets multisampling Setting to 0 disables multisampling

Source

pub fn set_high_dpi(self, enabled: bool) -> Self

Enable High DPI

Source

pub fn set_transparent(self, transparent: bool) -> Self

Set the background as transparent

Source

pub fn set_always_on_top(self, always_on_top: bool) -> Self

Set the background as transparent

Source

pub fn set_decorations(self, decorations: bool) -> Self

Enable or disable decorations

Source

pub fn set_visible(self, visible: bool) -> Self

Hide or show the window

Source

pub fn set_mouse_passthrough(self, mouse_passthrough: bool) -> Self

Mouse events pass through window

Source

pub fn set_app_id(self, app_id: &str) -> Self

Set the App ID On web it will use or create the canvas with this id.

Source

pub fn set_window_icon(self, window_icon_path: Option<PathBuf>) -> Self

Window icon path

Source

pub fn set_window_icon_data( self, window_icon_data: Option<&'static [u8]>, ) -> Self

Window icon data

Source

pub fn set_taskbar_icon(self, taskbar_icon_path: Option<PathBuf>) -> Self

Task bar icon path

Source

pub fn set_taskbar_icon_data( self, taskbar_icon_data: Option<&'static [u8]>, ) -> Self

Task bar icon data

Trait Implementations§

Source§

impl<S, B> BuildConfig<S, B> for WindowConfig
where B: Backend,

Source§

fn apply(&self, builder: AppBuilder<S, B>) -> AppBuilder<S, B>

Applies the configuration on the builder
Source§

fn late_evaluation(&self) -> bool

This config will be applied before the app is initiated not when is set
Source§

impl Clone for WindowConfig

Source§

fn clone(&self) -> WindowConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for WindowConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.