[−][src]Trait pixel_engine::traits::ShapesTrait
A trait that regroups all the Shapes Drawing
You don't need to implement anything other that [ScreenTrait
] to use it
Provided methods
fn draw_text(&mut self, x: u32, y: u32, scale: u32, col: Color, text: &str)
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
fn draw_line(&mut self, p1: (u32, u32), p2: (u32, u32), col: Color)
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.
fn draw_rect(&mut self, x: u32, y: u32, w: u32, h: u32, col: Color)
Draw a rectangle with the top left corner at (x, y)
and the bottom right corner at (x + w, y + h)
(both inclusive)
fn fill_rect(&mut self, x: u32, y: u32, w: u32, h: u32, col: Color)
Fill a rectangle with the top left corner at (x, y)
and the bottom right corner at (x + w, y + h)
(both inclusive)
fn draw_circle(&mut self, x: u32, y: u32, r: u32, col: Color)
Draw a circle with center (x, y)
and raduis r
fn fill_circle(&mut self, x: u32, y: u32, r: u32, col: Color)
Fill a circle with center (x, y)
and raduis r
fn draw_triangle(
&mut self,
pts1: (u32, u32),
pts2: (u32, u32),
pts3: (u32, u32),
col: Color
)
&mut self,
pts1: (u32, u32),
pts2: (u32, u32),
pts3: (u32, u32),
col: Color
)
Draw the edges of a triangle between the three points
fn fill_triangle(
&mut self,
pts1: (u32, u32),
pts2: (u32, u32),
pts3: (u32, u32),
col: Color
)
&mut self,
pts1: (u32, u32),
pts2: (u32, u32),
pts3: (u32, u32),
col: Color
)
Fill the given triangle
Implementors
impl<T> ShapesTrait for T where
T: ScreenTrait,
[src]
T: ScreenTrait,