Trait piston_window::Window[][src]

pub trait Window {
    pub fn set_should_close(&mut self, value: bool);
pub fn should_close(&self) -> bool;
pub fn size(&self) -> Size;
pub fn swap_buffers(&mut self);
pub fn wait_event(&mut self) -> Event;
pub fn wait_event_timeout(&mut self, timeout: Duration) -> Option<Event>;
pub fn poll_event(&mut self) -> Option<Event>;
pub fn draw_size(&self) -> Size; }

Trait representing the minimum requirements for defining a window.

This trait defines all the behavior needed for making an event loop.

An example of a working event loop can be found in the Piston-Tutorials repository under getting-started, or in the event loop examples.

When implementing the Window trait for a custom window backend, it is not necessary to emit Event::Loop variants, since these are generated by the event loop.

Required methods

pub fn set_should_close(&mut self, value: bool)[src]

Tells the window to close or stay open.

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

Returns true if the window should close.

pub fn size(&self) -> Size[src]

Gets the size of the window.

pub fn swap_buffers(&mut self)[src]

Swaps render buffers.

When this is set to false, this method must be called manually or through the window backend. By default it is set to true, so usually it is not needed in application code.

pub fn wait_event(&mut self) -> Event[src]

Wait indefinitely for an input event to be available from the window.

pub fn wait_event_timeout(&mut self, timeout: Duration) -> Option<Event>[src]

Wait for an input event to be available from the window or for the specified timeout to be reached.

Returns None only if there is no input event within the timeout.

pub fn poll_event(&mut self) -> Option<Event>[src]

Polls an input event from the window.

Return None if no events available.

pub fn draw_size(&self) -> Size[src]

Gets the draw size of the window.

This is equal to the size of the frame buffer of the inner window, excluding the title bar and borders.

This information is given to the client code through the Render event.

Loading content...

Implementations on Foreign Types

impl Window for GlutinWindow[src]

Loading content...

Implementors

impl Window for NoWindow[src]

impl<W> Window for PistonWindow<W> where
    W: Window
[src]

Loading content...