[][src]Trait luminance_glutin::Surface

pub trait Surface: GraphicsContext {
    type Event;
    type Error;
    fn new(
        dim: WindowDim,
        title: &str,
        win_opt: WindowOpt
    ) -> Result<Self, Self::Error>;
fn opts(&self) -> &WindowOpt;
fn set_cursor_mode(&mut self, mode: CursorMode) -> &mut Self;
fn set_num_samples<S>(&mut self, samples: S) -> &mut Self
    where
        S: Into<Option<u32>>
;
fn size(&self) -> [u32; 2];
fn wait_events(&'a mut self) -> Box<dyn Iterator<Item = Self::Event> + 'a>;
fn poll_events(&'a mut self) -> Box<dyn Iterator<Item = Self::Event> + 'a>;
fn swap_buffers(&mut self); fn width(&self) -> u32 { ... }
fn height(&self) -> u32 { ... }
fn back_buffer(
        &mut self
    ) -> Result<Framebuffer<Flat, Dim2, (), ()>, Self::Error> { ... } }

Rendering surface.

This type holds anything related to rendering. The interface is straight forward, so feel free to have a look around.

Associated Types

type Event

Type of events.

type Error

Type of surface errors.

Loading content...

Required methods

fn new(
    dim: WindowDim,
    title: &str,
    win_opt: WindowOpt
) -> Result<Self, Self::Error>

Create a surface along with its associated event stream and bootstrap a luminance environment that lives as long as the surface lives.

fn opts(&self) -> &WindowOpt

Retrieve opitions and allow editing them.

fn set_cursor_mode(&mut self, mode: CursorMode) -> &mut Self

Change the cursor mode.

fn set_num_samples<S>(&mut self, samples: S) -> &mut Self where
    S: Into<Option<u32>>, 

Change the multisampling state.

fn size(&self) -> [u32; 2]

Size of the surface’s framebuffer.

fn wait_events(&'a mut self) -> Box<dyn Iterator<Item = Self::Event> + 'a>

Get an iterator over events by blocking until the first event happens.

fn poll_events(&'a mut self) -> Box<dyn Iterator<Item = Self::Event> + 'a>

Get an iterator over events without blocking if no event is there.

fn swap_buffers(&mut self)

Swap the back and front buffers.

Loading content...

Provided methods

fn width(&self) -> u32

Width of the surface’s framebuffer.

Defaults

Defaults to .size()[0].

fn height(&self) -> u32

Height of the surface’s framebuffer.

Defaults

Defaults to .size()[1].

fn back_buffer(
    &mut self
) -> Result<Framebuffer<Flat, Dim2, (), ()>, Self::Error>

Get access to the back buffer.

Loading content...

Implementors

impl Surface for GlutinSurface[src]

type Error = Error

type Event = Event

Loading content...