feature: Introduced DrawPolyPro and DrawPolyLinesPro
This commit is contained in:
parent
dd8b5613ca
commit
c73ec23eae
|
|
@ -1259,8 +1259,10 @@ RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
|
|||
RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||
RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
||||
RLAPI void DrawPolyPro(Vector2 center, Vector2 *points, int pointCount, Color color); // Draw a filled polygon from an array of points (Vector version)
|
||||
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
||||
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
|
||||
RLAPI void DrawPolyLinesPro(Vector2 *points, int pointCount, Color color); // Draw a polygon outline from an array of points (Vector version)
|
||||
|
||||
// Splines drawing functions
|
||||
RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||
|
|
|
|||
|
|
@ -1489,6 +1489,53 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col
|
|||
#endif
|
||||
}
|
||||
|
||||
void DrawPolyPro(Vector2 center, Vector2 *points, int pointCount, Color color)
|
||||
{
|
||||
if (pointCount >= 3 && points != NULL)
|
||||
{
|
||||
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||
rlSetTexture(texShapes.id);
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
for (int i = 0; i < pointCount; i++)
|
||||
{
|
||||
int j = (i + 1) % pointCount;
|
||||
|
||||
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height);
|
||||
rlVertex2f(points[i].x, points[i].y);
|
||||
|
||||
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
|
||||
rlVertex2f(center.x, center.y);
|
||||
|
||||
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height);
|
||||
rlVertex2f(center.x, center.y);
|
||||
|
||||
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height);
|
||||
rlVertex2f(points[j].x, points[j].y);
|
||||
}
|
||||
|
||||
rlEnd();
|
||||
|
||||
rlSetTexture(0);
|
||||
#else
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
for (int i = 0; i < pointCount; i++)
|
||||
{
|
||||
int j = i + 1;
|
||||
if (j == pointCount) j = 0;
|
||||
|
||||
rlVertex2f(points[i].x, points[i].y);
|
||||
rlVertex2f(center.x, center.y);
|
||||
rlVertex2f(points[j].x, points[j].y);
|
||||
}
|
||||
|
||||
rlEnd();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a polygon outline of n sides
|
||||
void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color)
|
||||
{
|
||||
|
|
@ -1563,6 +1610,26 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
|
|||
#endif
|
||||
}
|
||||
|
||||
void DrawPolyLinesPro(Vector2 *points, int pointCount, Color color)
|
||||
{
|
||||
if (pointCount >= 3 && points != NULL)
|
||||
{
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
for (int i = 0; i < pointCount - 1; i++)
|
||||
{
|
||||
rlVertex2f(points[i].x, points[i].y);
|
||||
rlVertex2f(points[i + 1].x, points[i + 1].y);
|
||||
}
|
||||
|
||||
rlVertex2f(points[pointCount - 1].x, points[pointCount - 1].y);
|
||||
rlVertex2f(points[0].x, points[0].y);
|
||||
|
||||
rlEnd();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Splines functions
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user