summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2021-11-10 13:28:43 +0100
committerRay <[email protected]>2021-11-10 13:28:43 +0100
commit4853082a4fd5a3a1e507e10bafff0a68f186e813 (patch)
tree65c8d5836b5a07302a85171168e30ec1eb29d68c /src
parentf6180efd35ce8e788e42f7a1fdbb479f7edbfc01 (diff)
downloadraylib-4853082a4fd5a3a1e507e10bafff0a68f186e813.tar.gz
raylib-4853082a4fd5a3a1e507e10bafff0a68f186e813.zip
REVIEWED: DrawRectanglePro(), support TRIANGLES drawing
Diffstat (limited to 'src')
-rw-r--r--src/rshapes.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/rshapes.c b/src/rshapes.c
index 3fd93779..bd403f8e 100644
--- a/src/rshapes.c
+++ b/src/rshapes.c
@@ -662,8 +662,6 @@ void DrawRectangleRec(Rectangle rec, Color color)
// Draw a color-filled rectangle with pro parameters
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
{
- rlCheckRenderBatchLimit(4);
-
Vector2 topLeft = { 0 };
Vector2 topRight = { 0 };
Vector2 bottomLeft = { 0 };
@@ -701,7 +699,11 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
bottomRight.y = y + (dx + rec.width)*sinRotation + (dy + rec.height)*cosRotation;
}
+#if defined(SUPPORT_QUADS_DRAW_MODE)
+ rlCheckRenderBatchLimit(4);
+
rlSetTexture(texShapes.id);
+
rlBegin(RL_QUADS);
rlNormal3f(0.0f, 0.0f, 1.0f);
@@ -720,7 +722,25 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
rlVertex2f(topRight.x, topRight.y);
rlEnd();
+
rlSetTexture(0);
+#else
+ rlCheckRenderBatchLimit(6);
+
+ rlBegin(RL_TRIANGLES);
+
+ rlColor4ub(color.r, color.g, color.b, color.a);
+
+ rlVertex2f(topLeft.x, topLeft.y);
+ rlVertex2f(bottomLeft.x, bottomLeft.y);
+ rlVertex2f(topRight.x, topRight.y);
+
+ rlVertex2f(topRight.x, topRight.y);
+ rlVertex2f(bottomLeft.x, bottomLeft.y);
+ rlVertex2f(bottomRight.x, bottomRight.y);
+
+ rlEnd();
+#endif
}
// Draw a vertical-gradient-filled rectangle