Skip to main content

draw_polygon

Function draw_polygon 

Source
pub fn draw_polygon(points: &[Vector2], color: Color)
Expand description

Draws a filled convex polygon from points as a triangle fan. Fewer than 3 points draws nothing. Use draw_polygon_concave for concave shapes.

ยงExamples

let pts = [
    Vector2::new(100.0, 100.0), Vector2::new(200.0, 100.0),
    Vector2::new(220.0, 180.0), Vector2::new(80.0, 180.0),
];
draw_polygon(&pts, GREEN);