[−][src]Struct nannou::window::Window
A nannou window.
The Window
acts as a wrapper around the winit::Window
and vulkano::Surface
types and
manages the associated swapchain, 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]
pub fn hide(&self)
[src]
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]
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.
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.
pub fn rect(&self) -> Rect
[src]
The rectangle representing the position and dimensions of the window.
The window's position will always be [0.0, 0.0]
, as positions are generally described
relative to the centre of the window itself.
The dimensions will be equal to the result of inner_size_points
. This represents the area
of the that we can draw to in a DPI-agnostic manner, typically useful for drawing and UI
positioning.
Trait Implementations
impl Debug for Window
[src]
impl WinitWindow for Window
[src]
fn get_inner_size(&self) -> Option<(u32, u32)>
[src]
fn hidpi_factor(&self) -> f32
[src]
Auto Trait Implementations
impl !Send for Window
impl Unpin for Window
impl !Sync for Window
impl !UnwindSafe for Window
impl !RefUnwindSafe for Window
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> SafeBorrow<T> for T
[src]
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,