REVIEWED: DrawRectanglePro(), support TRIANGLES drawing
This commit is contained in:
parent
f6180efd35
commit
4853082a4f
1 changed files with 22 additions and 2 deletions
|
@ -662,8 +662,6 @@ void DrawRectangleRec(Rectangle rec, Color color)
|
||||||
// Draw a color-filled rectangle with pro parameters
|
// Draw a color-filled rectangle with pro parameters
|
||||||
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
|
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
|
||||||
{
|
{
|
||||||
rlCheckRenderBatchLimit(4);
|
|
||||||
|
|
||||||
Vector2 topLeft = { 0 };
|
Vector2 topLeft = { 0 };
|
||||||
Vector2 topRight = { 0 };
|
Vector2 topRight = { 0 };
|
||||||
Vector2 bottomLeft = { 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;
|
bottomRight.y = y + (dx + rec.width)*sinRotation + (dy + rec.height)*cosRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||||
|
rlCheckRenderBatchLimit(4);
|
||||||
|
|
||||||
rlSetTexture(texShapes.id);
|
rlSetTexture(texShapes.id);
|
||||||
|
|
||||||
rlBegin(RL_QUADS);
|
rlBegin(RL_QUADS);
|
||||||
|
|
||||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
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);
|
rlVertex2f(topRight.x, topRight.y);
|
||||||
|
|
||||||
rlEnd();
|
rlEnd();
|
||||||
|
|
||||||
rlSetTexture(0);
|
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
|
// Draw a vertical-gradient-filled rectangle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue