[][src]Trait rask_wasm::graphics::GraphicsApi

pub trait GraphicsApi: Sized {
    type GraphicsError: Display;
    fn new(width: u32, height: u32) -> Result<Self, ClientError>;
fn update_sprite_vector(
        &mut self,
        sprites: &[Sprite]
    ) -> Result<(), ClientError>;
fn upload_textures(
        &mut self,
        textures: &[(u32, u64, &Texture)]
    ) -> Result<(), ClientError>;
fn remove_textures(&mut self) -> Result<(), ClientError>;
fn draw(&mut self) -> Result<(), ClientError>;
fn set_size(&mut self, w: u32, h: u32);
fn update_size(&mut self, w: u32, h: u32);
fn ok(&self) -> Result<(), Self::GraphicsError>; }

Associated Types

type GraphicsError: Display

Loading content...

Required methods

fn new(width: u32, height: u32) -> Result<Self, ClientError>

Create a new graphics context. width and height is the resolution of the pixelated image.

fn update_sprite_vector(
    &mut self,
    sprites: &[Sprite]
) -> Result<(), ClientError>

Update the sprite vector to the given slice of sprites.

fn upload_textures(
    &mut self,
    textures: &[(u32, u64, &Texture)]
) -> Result<(), ClientError>

Upload the given id-to-texture mapping to the graphics context.

fn remove_textures(&mut self) -> Result<(), ClientError>

Remove all textures from the graphics context.

fn draw(&mut self) -> Result<(), ClientError>

Draw all sprites from the current sprite vector.

fn set_size(&mut self, w: u32, h: u32)

Force a canvas resizing to a given resolution.

fn update_size(&mut self, w: u32, h: u32)

Set the canvas size to given resolution. Do not update size if it has not changed.

fn ok(&self) -> Result<(), Self::GraphicsError>

Get the last graphics context error.

Loading content...

Implementors

impl GraphicsApi for WebGl2[src]

type GraphicsError = WebGl2Error

Loading content...