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 | The window. |
encoder | GFX encoder. |
device | GFX device. |
output_color | Output frame buffer. |
output_stencil | Output stencil buffer. |
g2d | Gfx2d. |
events | Event loop state. |
factory | The factory that was created along with the device. |
Methods
impl<W> PistonWindow<W> where W: Window, W::Event: GenericEvent
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 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 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.