Struct piston_window::PistonWindow
[−]
[src]
pub struct PistonWindow<W: Window = GlutinWindow> { pub window: W, pub encoder: GfxEncoder, pub device: Device, pub output_color: RenderTargetView<Resources, Srgba8>, pub output_stencil: DepthStencilView<Resources, DepthStencil>, pub g2d: Gfx2d<Resources>, pub events: WindowEvents, pub factory: Factory, }
Contains everything required for controlling window, graphics, event loop.
Fields
window: W
The window.
encoder: GfxEncoder
GFX encoder.
device: Device
GFX device.
output_color: RenderTargetView<Resources, Srgba8>
Output frame buffer.
output_stencil: DepthStencilView<Resources, DepthStencil>
Output stencil buffer.
g2d: Gfx2d<Resources>
Gfx2d.
events: WindowEvents
Event loop state.
factory: Factory
The factory that was created along with the device.
Methods
impl<W> PistonWindow<W> where W: Window, W::Event: GenericEvent
[src]
fn new(opengl: OpenGL, samples: u8, window: W) -> Self where W: OpenGLWindow
Creates a new piston window.
fn draw_2d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where W: OpenGLWindow, E: GenericEvent, F: FnOnce(Context, &mut G2d) -> U
Renders 2D graphics.
fn draw_3d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where W: OpenGLWindow, E: GenericEvent, F: FnOnce(&mut Self) -> U
Renders 3D graphics.
fn next(&mut self) -> Option<Event<W::Event>>
Returns next event. Cleans up after rendering and resizes frame buffers.
Trait Implementations
impl<W> BuildFromWindowSettings for PistonWindow<W> where W: Window + OpenGLWindow + BuildFromWindowSettings, W::Event: GenericEvent
[src]
fn build_from_window_settings(settings: WindowSettings) -> Result<PistonWindow<W>, String>
Builds window from window settings.
impl<W> Window for PistonWindow<W> where W: Window
[src]
type Event = W::Event
The event type emitted by poll_event
fn should_close(&self) -> bool
Returns true if window should close.
fn set_should_close(&mut self, value: bool)
Tells the window to close or stay open.
fn size(&self) -> Size
Gets the size of the window in user coordinates.
fn draw_size(&self) -> Size
Gets 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. Read more
fn swap_buffers(&mut self)
Swaps render buffers.
fn poll_event(&mut self) -> Option<Self::Event>
Polls event from window.
impl<W> AdvancedWindow for PistonWindow<W> where W: AdvancedWindow
[src]
fn get_title(&self) -> String
Gets a copy of the title of the window.
fn set_title(&mut self, title: String)
Sets the title of the window.
fn get_exit_on_esc(&self) -> bool
Gets whether to exit when pressing esc.
fn set_exit_on_esc(&mut self, value: bool)
Sets whether to exit when pressing esc.
fn set_capture_cursor(&mut self, value: bool)
Sets whether to capture/grab cursor. This is used to lock and hide cursor to the window, for example in a first-person shooter game. Read more
fn title(self, value: String) -> Self
Sets title on window.
fn exit_on_esc(self, value: bool) -> Self
Sets whether to exit when pressing esc.
fn capture_cursor(self, value: bool) -> Self
Sets whether to capture/grab cursor (see set_capture_cursor
).
impl<W> EventLoop for PistonWindow<W> where W: Window
[src]
fn set_ups(&mut self, frames: u64)
The number of updates per second Read more
fn set_max_fps(&mut self, frames: u64)
The maximum number of frames per second Read more
fn set_swap_buffers(&mut self, enable: bool)
Enable or disable automatic swapping of buffers.
fn set_bench_mode(&mut self, enable: bool)
Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Read more
fn ups(self, frames: u64) -> Self
The number of updates per second Read more
fn max_fps(self, frames: u64) -> Self
The maximum number of frames per second Read more
fn swap_buffers(self, enable: bool) -> Self
Enable or disable automatic swapping of buffers.
fn bench_mode(self, enable: bool) -> Self
Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Read more