Struct riddle_platform_winit::Window[][src]

pub struct Window { /* fields omitted */ }

A platform native window.

Construct windows using WindowBuilder.

The window is kept open for the lifetime of this object, once it is dropped the window will be closed during the next event loop pump.

Example

let rdl =  RiddleLib::new()?;

// Create a window
let mut window = Some(WindowBuilder::new().build(rdl.context())?);

rdl.run(move |rdl| {
    if window.is_some() {
        // Drop all handles to the window. It will be closed before the next invocation
        // of this closure.
        window.take();
    } else {
        // The window is closed. Exit.
        rdl.quit();
    }
})

Implementations

impl Window[src]

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

Get the size of the drawable area of the window in pixels

pub fn logical_size(&self) -> LogicalSize[src]

Get the size of the drawable area of the window in logical units.

pub fn scale_factor(&self) -> f64[src]

Get the scale factor of the window, based on how the window manager configures hidpi scaling

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

Set the window title

pub fn subscribe_to_events(&self, sub: &EventSub<PlatformEvent>)[src]

Attach a subscriber to the subset of platform events that relate to this window

Example

let rdl =  RiddleLib::new()?;
let subscriber: EventSub<PlatformEvent> = EventSub::new();

let window = WindowBuilder::new().build(rdl.context())?;
window.subscribe_to_events(&subscriber);

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

The window id which is used to identify this window in PlatformEvents

Trait Implementations

impl CloneHandle for Window[src]

type Handle = WindowHandle

The type which represents a strong reference, and which may be dereferenced as Self. Read more

type WeakHandle = WindowWeak

The type which represents a weak reference.

impl Drop for Window[src]

impl Eq for Window[src]

impl HasRawWindowHandle for Window[src]

impl PartialEq<Window> for Window[src]

impl WindowCommon for Window[src]

impl WinitWindowExt for Window[src]

Auto Trait Implementations

impl !RefUnwindSafe for Window

impl Send for Window

impl Sync for Window

impl Unpin for Window

impl !UnwindSafe for Window

Blanket Implementations

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

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

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

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.