pub trait ShapesTrait: SmartDrawingTrait {
    fn draw_text<P: Into<Vi2d>>(
        &mut self,
        pos: P,
        scale: u32,
        col: Color,
        text: &str
    ) { ... } fn draw_line<P: Into<Vi2d>>(&mut self, p1: P, p2: P, col: Color) { ... } fn draw_rect<P: Into<Vi2d>>(&mut self, pos: P, size: P, col: Color) { ... } fn fill_rect<P: Into<Vi2d>>(&mut self, pos: P, size: P, col: Color) { ... } fn draw_circle<P: Into<Vi2d>>(&mut self, pos: P, r: u32, col: Color) { ... } fn fill_circle<P: Into<Vi2d>>(&mut self, pos: P, r: u32, col: Color) { ... } fn draw_triangle<P: Into<Vi2d>>(
        &mut self,
        pts1: P,
        pts2: P,
        pts3: P,
        col: Color
    ) { ... } fn fill_triangle<P: Into<Vi2d>>(
        &mut self,
        pts1: P,
        pts2: P,
        pts3: P,
        col: Color
    ) { ... } }
Expand description

A trait that regroups all the Shapes Drawing You don’t need to implement anything other that DrawSpriteTrait to use it

Provided Methods

Draw text to the screen scale must be >= 1 The textsize will be equal to scale * 8 for the height and scale * 8 * text.len() for the width This will handle \n treating it as a new line, but wont do any newline stuff if it is drawing out of the screen

Draw a line between two points, You don’t need to do anything with the points for it to work, it will swap them it needed.

Draw a rectangle with the top left corner at (x, y) and the bottom right corner at (x + w, y + h) (both inclusive)

Fill a rectangle with the top left corner at (x, y) and the bottom right corner at (x + w, y + h) (both inclusive)

Draw a circle with center (x, y) and raduis r

Fill a circle with center (x, y) and raduis r

Draw the edges of a triangle between the three points

Fill the given triangle

Implementors