From 418153147eb086147cf1eb3f265f409327837e94 Mon Sep 17 00:00:00 2001 From: Rioni Date: Fri, 12 Apr 2024 00:57:26 +0200 Subject: [PATCH] Allowed users to optinoally define number of sides on draw_circle and draw_circle_lines --- src/shapes.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shapes.rs b/src/shapes.rs index 0b902b92..10329a42 100644 --- a/src/shapes.rs +++ b/src/shapes.rs @@ -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) { + 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) { + 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) {