pub trait WindowSize: HasRawWindowHandle {
    fn window_size(&self) -> (u32, u32);
}
Expand description

This trait is required in order to abstract over the windowing library

an implementation of this trait could look like this: pub struct WinitWindowWrapper<’a>(&’a Window);

impl WindowSize for WinitWindowWrapper<’_> {

fn window_size<T: Into<(u32, u32)>>(&self) -> T {
    let size = self.0.inner_size();
    (size.width, size.height)
}

}

unsafe impl HasRawWindowHandle for WinitWindowWrapper<’_> {

fn raw_window_handle(&self) -> RawWindowHandle {
    self.0.raw_window_handle()
}

}

Required Methods

Returns the size of the window in the format (width, height)

Implementors