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: Events,
    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: Events

Event loop state.

factory: Factory

The factory that was created along with the device.

Implementations

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

pub fn new(opengl: OpenGL, samples: u8, window: W) -> Self where
    W: OpenGLWindow
[src]

Creates a new piston window.

pub fn create_texture_context(&mut self) -> G2dTextureContext[src]

Creates context used to create and update textures.

pub fn load_font<P: AsRef<Path>>(&mut self, path: P) -> Result<Glyphs, Error>[src]

Loads font from a path.

pub fn draw_2d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where
    W: OpenGLWindow,
    E: GenericEvent,
    F: FnOnce(Context, &mut G2d<'_>, &mut Device) -> U, 
[src]

Renders 2D graphics.

Calls the closure on render events. There is no need to filter events manually, and there is no overhead.

pub fn draw_3d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where
    W: OpenGLWindow,
    E: GenericEvent,
    F: FnOnce(&mut Self) -> U, 
[src]

Renders 3D graphics.

Calls the closure on render events. There is no need to filter events manually, and there is no overhead.

pub fn event<E: GenericEvent>(&mut self, event: &E)[src]

Let window handle new event. Cleans up after rendering and resizes frame buffers.

Trait Implementations

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

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

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

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

type Item = Event

The type of the elements being iterated over.

fn next(&mut self) -> Option<Self::Item>[src]

Returns next event. Cleans up after rendering and resizes frame buffers.

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

Auto Trait Implementations

impl<W = GlutinWindow> !RefUnwindSafe for PistonWindow<W>

impl<W = GlutinWindow> !Send for PistonWindow<W>

impl<W = GlutinWindow> !Sync for PistonWindow<W>

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

impl<W = GlutinWindow> !UnwindSafe for PistonWindow<W>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.