diff options
| author | Peter0x44 <[email protected]> | 2023-10-22 16:13:49 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-22 17:13:49 +0200 |
| commit | e33e9da277865207123158430ebf42cc5626e5b7 (patch) | |
| tree | 84cd75d4a00ada58c05009b98e0e63fb42107911 /src/rshapes.c | |
| parent | f0124df0e8bbeb3e9ad2acf08b0f3610e812c8d6 (diff) | |
| download | raylib-e33e9da277865207123158430ebf42cc5626e5b7.tar.gz raylib-e33e9da277865207123158430ebf42cc5626e5b7.zip | |
Add DrawCircleLinesV for consistency (#3452)
ImageDrawCircleLinesV already existed, so I'm not sure why this was
missing. It is trivial to implement, anyway
Diffstat (limited to 'src/rshapes.c')
| -rw-r--r-- | src/rshapes.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rshapes.c b/src/rshapes.c index f3061f8b..de64f159 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -671,14 +671,20 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co // Draw circle outline void DrawCircleLines(int centerX, int centerY, float radius, Color color) { + DrawCircleLinesV((Vector2){ (float)centerX, (float)centerY }, radius, color); +} + +// Draw circle outline (Vector version) +void DrawCircleLinesV(Vector2 center, float radius, Color color) +{ rlBegin(RL_LINES); rlColor4ub(color.r, color.g, color.b, color.a); // NOTE: Circle outline is drawn pixel by pixel every degree (0 to 360) for (int i = 0; i < 360; i += 10) { - rlVertex2f(centerX + cosf(DEG2RAD*i)*radius, centerY + sinf(DEG2RAD*i)*radius); - rlVertex2f(centerX + cosf(DEG2RAD*(i + 10))*radius, centerY + sinf(DEG2RAD*(i + 10))*radius); + rlVertex2f(center.x + cosf(DEG2RAD*i)*radius, center.y + sinf(DEG2RAD*i)*radius); + rlVertex2f(center.x + cosf(DEG2RAD*(i + 10))*radius, center.y + sinf(DEG2RAD*(i + 10))*radius); } rlEnd(); } |
