Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed users to optinoally define number of sides on draw_circle and draw_circle_lines #713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading