[][src]Struct nannou::window::Window

pub struct Window { /* fields omitted */ }

An OpenGL window.

The Window acts as a wrapper around the glium::Display type, providing a more nannou-friendly API.

Methods

impl Window[src]

pub fn set_title(&self, title: &str)[src]

Modifies the title of the window.

This is a no-op if the window has already been closed.

pub fn show(&self)[src]

Shows the window if it was hidden.

Platform-specific

Has no effect on Android.

pub fn hide(&self)[src]

Hides the window if it was visible.

Platform-specific

Has no effect on Android.

pub fn position(&self) -> (i32, i32)[src]

The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.

Note that the top-left hand corner of the desktop is not necessarily the same as the screen. If the user uses a desktop with multiple monitors, the top-left hand corner of the desktop is the top-left hand corner of the monitor at the top-left of the desktop.

The coordinates can be negative if the top-left hand corner of the window is outside of the visible screen region.

pub fn set_position(&self, x: i32, y: i32)[src]

Modifies the position of the window.

See get_position for more information about the returned coordinates.

pub fn inner_size_pixels(&self) -> (u32, u32)[src]

The size in pixels of the client area of the window.

The client area is the content of the window, excluding the title bar and borders. These are the dimensions of the frame buffer, and the dimensions that you should use when you call glViewport.

pub fn inner_size_points(&self) -> (Default, Default)[src]

The size in points of the client area of the window.

The client area is the content of the window, excluding the title bar and borders. To get the dimensions of the frame buffer when calling glViewport, multiply with hidpi factor.

This is the same as dividing the result of inner_size_pixels() by hidpi_factor().

pub fn outer_size_pixels(&self) -> (u32, u32)[src]

The size of the window in pixels.

These dimensions include title bar and borders. If you don't want these, you should use inner_size_pixels instead.

pub fn outer_size_points(&self) -> (f32, f32)[src]

The size of the window in points.

These dimensions include title bar and borders. If you don't want these, you should use inner_size_points instead.

This is the same as dividing the result of outer_size_pixels() by hidpi_factor().

pub fn set_inner_size_pixels(&self, width: u32, height: u32)[src]

Modifies the inner size of the window.

See the inner_size methods for more informations about the values.

pub fn set_inner_size_points(&self, width: f32, height: f32)[src]

Modifies the inner size of the window using point values.

Internally, the given width and height are multiplied by the hidpi_factor to get the values in pixels before calling set_inner_size_pixels internally.

pub fn hidpi_factor(&self) -> Default[src]

The ratio between the backing framebuffer resolution and the window size in screen pixels.

This is typically 1.0 for a normal display, 2.0 for a retina display and higher on more modern displays.

pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), String>[src]

Changes the position of the cursor in window coordinates.

pub fn set_cursor(&self, state: MouseCursor)[src]

Modifies the mouse cursor of the window.

Platform-specific

Has no effect on Android.

pub fn grab_cursor(&self, grab: bool) -> Result<(), String>[src]

Grabs the cursor, preventing it from leaving the window.

Platform-specific

On macOS, this presently merely locks the cursor in a fixed location, which looks visually awkward.

This has no effect on Android or iOS.

pub fn hide_cursor(&self, hide: bool)[src]

Hides the cursor, making it invisible but still usable.

Platform-specific

On Windows and X11, the cursor is only hidden within the confines of the window.

On macOS, the cursor is hidden as long as the window has input focus, even if the cursor is outside of the window.

This has no effect on Android or iOS.

pub fn set_maximized(&self, maximized: bool)[src]

Sets the window to maximized or back.

pub fn set_fullscreen(&self, monitor: Option<MonitorId>)[src]

Set the window to fullscreen on the monitor associated with the given Id.

Call this method again with None to revert back from fullscreen.

Platform-specific

Has no effect on Android.

pub fn current_monitor(&self) -> MonitorId[src]

The current monitor that the window is on or the primary monitor if nothing matches.

pub fn id(&self) -> Id[src]

A unique identifier associated with this window.

pub fn surface(&self) -> &Surface[src]

Returns a reference to the window's Vulkan swapchain surface.

pub fn swapchain(&self) -> &Swapchain[src]

The swapchain associated with this window's vulkan surface.

pub fn swapchain_device(&self) -> &Arc<Device>[src]

The vulkan logical device on which the window's swapchain is running.

This is shorthand for DeviceOwned::device(window.swapchain()).

pub fn swapchain_queue(&self) -> &Arc<Queue>[src]

The vulkan graphics queue on which the window swapchain work is run.

Important traits for &'_ [u8]
pub fn swapchain_images(&self) -> &[Arc<SwapchainImage>][src]

The vulkan images associated with the window's swapchain.

This method is exposed in order to allow for interop with low-level vulkano code (e.g. framebuffer creation). We recommend that you avoid storing these images as the swapchain and its images may be recreated at any moment in time.

pub fn msaa_samples(&self) -> u32[src]

The number of samples used in the MSAA for the image associated with the view function's Frame type.

Note: If the user specified a raw_view function rather than a view function, this value will always return 1.

pub fn is_fullscreen(&self) -> bool[src]

Attempts to determine whether or not the window is currently fullscreen.

TODO: This currently relies on comparing outer_size_pixels to the dimensions of the current_monitor, which may not be exactly accurate on some platforms or even conceptually correct in the case that a title bar is included or something. This should probably be a method upstream within the winit crate itself. Alternatively we could attempt to manually track whether or not the window is fullscreen ourselves, however this could get quite complicated quite quickly.

pub fn elapsed_frames(&self) -> u64[src]

The number of times view has been called with a Frame for this window.

Trait Implementations

impl Debug for Window[src]

impl WinitWindow for Window[src]

Auto Trait Implementations

impl !Send for Window

impl !Sync for Window

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Content for T[src]

impl<T> SafeBorrow<T> for T[src]

impl<T> Erased for T

impl<S> FromSample<S> for S[src]

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.