Skip to main content

Draw

Trait Draw 

Source
pub trait Draw {
    // Provided methods
    fn draw_buffer(
        &mut self,
        _screen_buf: &[u8],
        _screen_width: usize,
        _screen_height: usize,
    ) { ... }
    fn clear_screen(&mut self) { ... }
}
Expand description

Implement this trait on a type and use it to draw to or clear the screen.

Provided Methods§

Source

fn draw_buffer( &mut self, _screen_buf: &[u8], _screen_width: usize, _screen_height: usize, )

This function will be called each time the interpreter requests to draw to the screen. The buffer you are given is just a flat list, but you are given the width and height so you can make it square yourself.

Source

fn clear_screen(&mut self)

Clear screen will simply be called when the interpreter calls the clear screen instruction.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§