pub struct Window { /* private fields */ }
Expand description
Window struct, represents a platform window.
Implementations§
source§impl Window
impl Window
sourcepub fn screen_width(&self) -> u32
pub fn screen_width(&self) -> u32
Get the window width (in screen coordinates).
sourcepub fn screen_height(&self) -> u32
pub fn screen_height(&self) -> u32
Get the window height (in screen coordinates).
sourcepub fn move_to(&self, x: i32, y: i32)
pub fn move_to(&self, x: i32, y: i32)
Move the window to a new position (in screen coordinates) relative to the top-left of the monitor area.
sourcepub fn move_to_center(&self)
pub fn move_to_center(&self)
Move the window to the center of the monitor.
sourcepub fn x(&self) -> i32
pub fn x(&self) -> i32
Get the x-position of the window (in screen coordinates) relative to the top-left of the monitor area.
sourcepub fn y(&self) -> i32
pub fn y(&self) -> i32
Get the y-position of the window (in screen coordinates) relative to the top-left of the monitor area.
sourcepub fn is_fullscreen(&self) -> bool
pub fn is_fullscreen(&self) -> bool
Whether or not the window is fullscreen.
sourcepub fn set_cursor(&self, cursor: Cursor)
pub fn set_cursor(&self, cursor: Cursor)
Set the cursor.
sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Whether or not the window is currently visible (not hidden).
sourcepub fn screen_to_pixels(&self, val: i32) -> i32
pub fn screen_to_pixels(&self, val: i32) -> i32
Convert screen coordinates to pixels using the current DPI scale.
sourcepub fn pixels_to_screen(&self, val: i32) -> i32
pub fn pixels_to_screen(&self, val: i32) -> i32
Convert pixels to screen coordinates using the current DPI scale.
sourcepub fn set_close_callback<F>(&self, callback: F)
pub fn set_close_callback<F>(&self, callback: F)
Called when the Window is closed.
§Callback Arguments
window: &Window
- The window that fired the event (eg. self)
sourcepub fn set_resize_callback<F>(&self, callback: F)
pub fn set_resize_callback<F>(&self, callback: F)
Called when the Window is resized.
§Callback Arguments
window: &Window
- The window that fired the event (eg. self)width: u32
- The new width of the window (in pixels)height: u32
- The new height of the window (in pixels)