Window

Struct Window 

Source
pub struct Window(/* private fields */);
Expand description

The window on the user’s desktop or in the browser tab

Implementations§

Source§

impl Window

Source

pub fn set_cursor_icon(&self, icon: Option<CursorIcon>)

Set the cursor icon to some value, or set it to invisible (None)

Source

pub fn size(&self) -> Vector

Get the size of the window in logical units

On a high-dpi display, this doesn’t correspond to physical pixels and must be multiplied by scale_factor when passing sizes to functions like set_viewport

Source

pub fn set_size(&self, size: Vector)

Set the size of the inside of the window in logical units

Source

pub fn set_title(&self, title: &str)

Set the title of the window or browser tab

Source

pub fn set_fullscreen(&self, fullscreen: bool)

Set if the window should be fullscreen or not

On desktop, it will instantly become fullscreen (borderless windowed on Windows and Linux, and fullscreen on macOS). On web, it will become fullscreen after the next user interaction, due to browser API restrictions.

Source

pub fn scale_factor(&self) -> f32

The DPI scale factor of the window

Mostly, this isn’t important to you. Some computer screens have more “physical” pixels than “logical” pixels, allowing them to draw sharper-looking images. Quicksilver abstracts this away. However, if you are manually setting the viewport, you need to take this into account.

Source

pub fn present(&self)

Draw the current frame to the screen

If vsync is enabled, this will block until the frame is completed on desktop. On web, there is no way to control vsync, or to manually control presentation, so this function is a no-op.

Auto Trait Implementations§

§

impl Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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> 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, 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.