Skip to main content

Drawable

Trait Drawable 

Source
pub trait Drawable {
    // Required methods
    fn draw<T: Drawer>(&self, window: &mut T);
    fn draw_with_context(&self, context: &mut Context<'_>);
    fn update(&mut self);

    // Provided method
    fn setup_draw(&self, context: &mut Context<'_>) { ... }
}
Expand description

Trait that can be use to draw on window

Required Methods§

Source

fn draw<T: Drawer>(&self, window: &mut T)

Draw the drawable structure, you need a Drawer(Where the struct will be draw)

Source

fn draw_with_context(&self, context: &mut Context<'_>)

Draw with a particular context

Source

fn update(&mut self)

Update the openGL state of the drawable entity Should be call often so be carefull when implementing.

Provided Methods§

Source

fn setup_draw(&self, context: &mut Context<'_>)

Setup the draw for the final system you don’t have to implement it in a normal drawable

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Drawable for Sprite

Drawing trait for sprite sturct

Source§

impl Drawable for SpriteBatch

Source§

impl Drawable for Text

Source§

impl Drawable for VertexBuffer