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.

Trait Implementations

impl<W> BuildFromWindowSettings for PistonWindow<W> where W: Window + OpenGLWindow + BuildFromWindowSettings, W::Event: GenericEvent

fn build_from_window_settings(settings: WindowSettings) -> Result<PistonWindow<W>, String>

impl<W> Window for PistonWindow<W> where W: Window

type Event = W::Event

fn should_close(&self) -> bool

fn set_should_close(&mut self, value: bool)

fn size(&self) -> Size

fn draw_size(&self) -> Size

fn swap_buffers(&mut self)

fn poll_event(&mut self) -> Option<Self::Event>

impl<W> AdvancedWindow for PistonWindow<W> where W: AdvancedWindow

fn get_title(&self) -> String

fn set_title(&mut self, title: String)

fn get_exit_on_esc(&self) -> bool

fn set_exit_on_esc(&mut self, value: bool)

fn set_capture_cursor(&mut self, value: bool)

fn title(self, value: String) -> Self

fn exit_on_esc(self, value: bool) -> Self

fn capture_cursor(self, value: bool) -> Self

impl<W> EventLoop for PistonWindow<W> where W: Window

fn set_ups(&mut self, frames: u64)

fn set_max_fps(&mut self, frames: u64)

fn set_swap_buffers(&mut self, enable: bool)

fn set_bench_mode(&mut self, enable: bool)

fn ups(self, frames: u64) -> Self

fn max_fps(self, frames: u64) -> Self

fn swap_buffers(self, enable: bool) -> Self

fn bench_mode(self, enable: bool) -> Self