Skip to content

Commit

Permalink
Allowed users to optinoally define number of sides on draw_circle and…
Browse files Browse the repository at this point in the history
… draw_circle_lines
  • Loading branch information
Nrosa01 committed Apr 11, 2024
1 parent f451960 commit 4181531
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,16 @@ pub fn draw_poly_lines(
}

/// Draws a solid circle centered at `[x, y]` with a given radius `r` and `color`.
pub fn draw_circle(x: f32, y: f32, r: f32, color: Color) {
draw_poly(x, y, 20, r, 0., color);
pub fn draw_circle(x: f32, y: f32, r: f32, color: Color, sides: Option<u8>) {
draw_poly(x, y, sides.unwrap_or(20), r, 0., color);
}

/// Draws a circle outline centered at `[x, y]` with a given radius, line `thickness` and `color`.
pub fn draw_circle_lines(x: f32, y: f32, r: f32, thickness: f32, color: Color) {
draw_poly_lines(x, y, 20, r, 0., thickness, color);
pub fn draw_circle_lines(x: f32, y: f32, r: f32, thickness: f32, color: Color, sides: Option<u8>) {
draw_poly_lines(x, y, sides.unwrap_or(20), r, 0., thickness, color);
}


/// Draws a solid ellipse centered at `[x, y]` with a given size `[w, h]`,
/// clockwise `rotation` (in degrees) and `color`.
pub fn draw_ellipse(x: f32, y: f32, w: f32, h: f32, rotation: f32, color: Color) {
Expand Down

0 comments on commit 4181531

Please sign in to comment.