Add DrawCircleGradientV: Vector2 variant for gradient circles
Fixes issue #5738 - DrawCircleGradient doesn't have a Vector2 variant. This adds DrawCircleGradientV() function that accepts a Vector2 center parameter, making it usable with Camera and small world-space coordinates. The implementation follows the same delegation pattern as other circle functions: - DrawCircle() delegates to DrawCircleV() - DrawCircleLines() delegates to DrawCircleLinesV() - DrawCircleGradient() now delegates to DrawCircleGradientV() This maintains API consistency across all circle drawing functions.
This commit is contained in:
parent
c5fc771622
commit
51504ef6ec
|
|
@ -1282,6 +1282,7 @@ RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color);
|
||||||
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
||||||
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
||||||
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
||||||
|
RLAPI void DrawCircleGradientV(Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle (Vector version)
|
||||||
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||||
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||||
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
||||||
|
|
|
||||||
|
|
@ -475,16 +475,22 @@ void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float
|
||||||
|
|
||||||
// Draw a gradient-filled circle
|
// Draw a gradient-filled circle
|
||||||
void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer)
|
void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer)
|
||||||
|
{
|
||||||
|
DrawCircleGradientV((Vector2){ (float)centerX, (float)centerY }, radius, inner, outer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a gradient-filled circle (Vector version)
|
||||||
|
void DrawCircleGradientV(Vector2 center, float radius, Color inner, Color outer)
|
||||||
{
|
{
|
||||||
rlBegin(RL_TRIANGLES);
|
rlBegin(RL_TRIANGLES);
|
||||||
for (int i = 0; i < 360; i += 10)
|
for (int i = 0; i < 360; i += 10)
|
||||||
{
|
{
|
||||||
rlColor4ub(inner.r, inner.g, inner.b, inner.a);
|
rlColor4ub(inner.r, inner.g, inner.b, inner.a);
|
||||||
rlVertex2f((float)centerX, (float)centerY);
|
rlVertex2f(center.x, center.y);
|
||||||
rlColor4ub(outer.r, outer.g, outer.b, outer.a);
|
rlColor4ub(outer.r, outer.g, outer.b, outer.a);
|
||||||
rlVertex2f((float)centerX + cosf(DEG2RAD*(i + 10))*radius, (float)centerY + sinf(DEG2RAD*(i + 10))*radius);
|
rlVertex2f(center.x + cosf(DEG2RAD*(i + 10))*radius, center.y + sinf(DEG2RAD*(i + 10))*radius);
|
||||||
rlColor4ub(outer.r, outer.g, outer.b, outer.a);
|
rlColor4ub(outer.r, outer.g, outer.b, outer.a);
|
||||||
rlVertex2f((float)centerX + cosf(DEG2RAD*i)*radius, (float)centerY + sinf(DEG2RAD*i)*radius);
|
rlVertex2f(center.x + cosf(DEG2RAD*i)*radius, center.y + sinf(DEG2RAD*i)*radius);
|
||||||
}
|
}
|
||||||
rlEnd();
|
rlEnd();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user