Struct piston::event::WindowEvents
[−]
[src]
pub struct WindowEvents<W, E> where E: EventMap<W::Event>, W: Window {
// some fields omitted
}
An event loop iterator
Warning: Because the iterator polls events from the window back-end, it must be used on the same thread as the window back-end (usually main thread), unless the window back-end supports multi-thread event polling.
Methods
impl<W, E> WindowEvents<W, E> where E: EventMap<W::Event>, W: Window
fn new(window: Rc<RefCell<W>>) -> WindowEvents<W, E>
Creates a new event iterator with default UPS and FPS settings.
fn ups(self, frames: u64) -> WindowEvents<W, E>
The number of updates per second
This is the fixed update rate on average over time. If the event loop lags, it will try to catch up.
fn max_fps(self, frames: u64) -> WindowEvents<W, E>
The maximum number of frames per second
The frame rate can be lower because the next frame is always scheduled from the previous frame. This causes the frames to "slip" over time.
fn swap_buffers(self, enable: bool) -> WindowEvents<W, E>
Enable or disable automatic swapping of buffers.