From 0d9ccb8756df2d0af9892ba5aac5503fed0ceffe Mon Sep 17 00:00:00 2001 From: Matthew Roush Date: Sat, 8 Aug 2026 23:08:32 -0400 Subject: [PATCH] [rshapes] Fix drawing circle sectors Functions that draw a sector of a circle would keep drawing segments past a full rotation, which looked bad. --- src/rshapes.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rshapes.c b/src/rshapes.c index 4e7374260..cd1fa1d35 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -1481,6 +1481,9 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA endAngle = tmp; } + // Drawing a whole circle, things get weird without limiting the circle to 360 degrees + if (endAngle - startAngle >= 360.0f) endAngle = startAngle + 360.0f; + int minSegments = (int)ceilf((endAngle - startAngle)/90); if (segments < minSegments) @@ -1573,6 +1576,9 @@ void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle = tmp; } + // Drawing a whole circle, things get weird without limiting the circle to 360 degrees + if (endAngle - startAngle >= 360.0f) endAngle = startAngle + 360.0f; + int minSegments = (int)ceilf((endAngle - startAngle)/90); if (segments < minSegments) @@ -1704,6 +1710,9 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startA endAngle = tmp; } + // Drawing a whole circle, things get weird without limiting the circle to 360 degrees + if (endAngle - startAngle >= 360.0f) endAngle = startAngle + 360.0f; + int minSegments = (int)ceilf((endAngle - startAngle)/90); if (segments < minSegments) @@ -1795,6 +1804,9 @@ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float s endAngle = tmp; } + // Drawing a whole circle, things get weird without limiting the circle to 360 degrees + if (endAngle - startAngle >= 360.0f) endAngle = startAngle + 360.0f; + int minSegments = (int)ceilf((endAngle - startAngle)/90); if (segments < minSegments)