|
@@ -98,7 +98,7 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
|
// Draw a color-filled circle
|
|
// Draw a color-filled circle
|
|
void DrawCircle(int centerX, int centerY, float radius, Color color)
|
|
void DrawCircle(int centerX, int centerY, float radius, Color color)
|
|
{
|
|
{
|
|
- DrawPoly((Vector2){ centerX, centerY }, 36, radius, 0, color);
|
|
|
|
|
|
+ DrawCircleV((Vector2){ centerX, centerY }, radius, color);
|
|
}
|
|
}
|
|
|
|
|
|
// Draw a gradient-filled circle
|
|
// Draw a gradient-filled circle
|
|
@@ -119,17 +119,40 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co
|
|
}
|
|
}
|
|
|
|
|
|
// Draw a color-filled circle (Vector version)
|
|
// Draw a color-filled circle (Vector version)
|
|
|
|
+// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw)
|
|
void DrawCircleV(Vector2 center, float radius, Color color)
|
|
void DrawCircleV(Vector2 center, float radius, Color color)
|
|
{
|
|
{
|
|
- rlBegin(RL_TRIANGLES);
|
|
|
|
- for (int i = 0; i < 360; i += 10)
|
|
|
|
- {
|
|
|
|
- rlColor4ub(color.r, color.g, color.b, color.a);
|
|
|
|
- rlVertex2i(center.x, center.y);
|
|
|
|
- rlVertex2f(center.x + sin(DEG2RAD*i)*radius, center.y + cos(DEG2RAD*i)*radius);
|
|
|
|
- rlVertex2f(center.x + sin(DEG2RAD*(i + 10)) * radius, center.y + cos(DEG2RAD*(i + 10)) * radius);
|
|
|
|
- }
|
|
|
|
- rlEnd();
|
|
|
|
|
|
+ if (rlGetVersion() == OPENGL_11)
|
|
|
|
+ {
|
|
|
|
+ rlBegin(RL_TRIANGLES);
|
|
|
|
+ for (int i = 0; i < 360; i += 10)
|
|
|
|
+ {
|
|
|
|
+ rlColor4ub(color.r, color.g, color.b, color.a);
|
|
|
|
+
|
|
|
|
+ rlVertex2i(center.x, center.y);
|
|
|
|
+ rlVertex2f(center.x + sin(DEG2RAD*i)*radius, center.y + cos(DEG2RAD*i)*radius);
|
|
|
|
+ rlVertex2f(center.x + sin(DEG2RAD*(i + 10)) * radius, center.y + cos(DEG2RAD*(i + 10)) * radius);
|
|
|
|
+ }
|
|
|
|
+ rlEnd();
|
|
|
|
+ }
|
|
|
|
+ else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
|
|
|
+ {
|
|
|
|
+ rlEnableTexture(whiteTexture); // Default white texture
|
|
|
|
+
|
|
|
|
+ rlBegin(RL_QUADS);
|
|
|
|
+ for (int i = 0; i < 360; i += 20)
|
|
|
|
+ {
|
|
|
|
+ rlColor4ub(color.r, color.g, color.b, color.a);
|
|
|
|
+
|
|
|
|
+ rlVertex2i(center.x, center.y);
|
|
|
|
+ rlVertex2f(center.x + sin(DEG2RAD*i)*radius, center.y + cos(DEG2RAD*i)*radius);
|
|
|
|
+ rlVertex2f(center.x + sin(DEG2RAD*(i + 10)) * radius, center.y + cos(DEG2RAD*(i + 10)) * radius);
|
|
|
|
+ rlVertex2f(center.x + sin(DEG2RAD*(i + 20)) * radius, center.y + cos(DEG2RAD*(i + 20)) * radius);
|
|
|
|
+ }
|
|
|
|
+ rlEnd();
|
|
|
|
+
|
|
|
|
+ rlDisableTexture();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// Draw circle outline
|
|
// Draw circle outline
|
|
@@ -178,6 +201,7 @@ void DrawRectangleGradient(int posX, int posY, int width, int height, Color colo
|
|
}
|
|
}
|
|
|
|
|
|
// Draw a color-filled rectangle (Vector version)
|
|
// Draw a color-filled rectangle (Vector version)
|
|
|
|
+// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw)
|
|
void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|
void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|
{
|
|
{
|
|
if (rlGetVersion() == OPENGL_11)
|
|
if (rlGetVersion() == OPENGL_11)
|
|
@@ -196,7 +220,6 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|
}
|
|
}
|
|
else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
|
else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
|
{
|
|
{
|
|
- // NOTE: This shape uses QUADS to avoid drawing order issues (view rlglDraw)
|
|
|
|
rlEnableTexture(whiteTexture); // Default white texture
|
|
rlEnableTexture(whiteTexture); // Default white texture
|
|
|
|
|
|
rlBegin(RL_QUADS);
|
|
rlBegin(RL_QUADS);
|
|
@@ -221,22 +244,33 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|
}
|
|
}
|
|
|
|
|
|
// Draw rectangle outline
|
|
// Draw rectangle outline
|
|
|
|
+// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw)
|
|
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|
-{
|
|
|
|
- rlBegin(RL_LINES);
|
|
|
|
- rlColor4ub(color.r, color.g, color.b, color.a);
|
|
|
|
- rlVertex2i(posX + 1, posY + 1);
|
|
|
|
- rlVertex2i(posX + width, posY + 1);
|
|
|
|
|
|
+{
|
|
|
|
+ if (rlGetVersion() == OPENGL_11)
|
|
|
|
+ {
|
|
|
|
+ rlBegin(RL_LINES);
|
|
|
|
+ rlColor4ub(color.r, color.g, color.b, color.a);
|
|
|
|
+ rlVertex2i(posX + 1, posY + 1);
|
|
|
|
+ rlVertex2i(posX + width, posY + 1);
|
|
|
|
|
|
- rlVertex2i(posX + width, posY + 1);
|
|
|
|
- rlVertex2i(posX + width, posY + height);
|
|
|
|
|
|
+ rlVertex2i(posX + width, posY + 1);
|
|
|
|
+ rlVertex2i(posX + width, posY + height);
|
|
|
|
|
|
- rlVertex2i(posX + width, posY + height);
|
|
|
|
- rlVertex2i(posX + 1, posY + height);
|
|
|
|
|
|
+ rlVertex2i(posX + width, posY + height);
|
|
|
|
+ rlVertex2i(posX + 1, posY + height);
|
|
|
|
|
|
- rlVertex2i(posX + 1, posY + height);
|
|
|
|
- rlVertex2i(posX + 1, posY + 1);
|
|
|
|
- rlEnd();
|
|
|
|
|
|
+ rlVertex2i(posX + 1, posY + height);
|
|
|
|
+ rlVertex2i(posX + 1, posY + 1);
|
|
|
|
+ rlEnd();
|
|
|
|
+ }
|
|
|
|
+ else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
|
|
|
+ {
|
|
|
|
+ DrawRectangle(posX, posY, width, 1, color);
|
|
|
|
+ DrawRectangle(posX + width - 1, posY + 1, 1, height - 2, color);
|
|
|
|
+ DrawRectangle(posX, posY + height - 1, width, 1, color);
|
|
|
|
+ DrawRectangle(posX, posY + 1, 1, height - 2, color);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// Draw a triangle
|
|
// Draw a triangle
|