ADDED: DrawPolyLines()
This commit is contained in:
parent
fcf15fe8c0
commit
e0d4cc3143
2 changed files with 26 additions and 0 deletions
|
@ -1070,6 +1070,7 @@ RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);
|
||||||
RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||||
RLAPI void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color); // Draw a triangle strip defined by points
|
RLAPI void DrawTriangleStrip(Vector2 *points, int pointsCount, 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 DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
||||||
|
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
||||||
|
|
||||||
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
|
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
|
||||||
|
|
||||||
|
|
25
src/shapes.c
25
src/shapes.c
|
@ -1346,6 +1346,31 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col
|
||||||
rlPopMatrix();
|
rlPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw a polygon outline of n sides
|
||||||
|
void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color)
|
||||||
|
{
|
||||||
|
if (sides < 3) sides = 3;
|
||||||
|
float centralAngle = 0.0f;
|
||||||
|
|
||||||
|
if (rlCheckBufferLimit(3*(360/sides))) rlglDraw();
|
||||||
|
|
||||||
|
rlPushMatrix();
|
||||||
|
rlTranslatef(center.x, center.y, 0.0f);
|
||||||
|
rlRotatef(rotation, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
rlBegin(RL_LINES);
|
||||||
|
for (int i = 0; i < sides; i++)
|
||||||
|
{
|
||||||
|
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||||
|
|
||||||
|
rlVertex2f(sinf(DEG2RAD*centralAngle)*radius, cosf(DEG2RAD*centralAngle)*radius);
|
||||||
|
centralAngle += 360.0f/(float)sides;
|
||||||
|
rlVertex2f(sinf(DEG2RAD*centralAngle)*radius, cosf(DEG2RAD*centralAngle)*radius);
|
||||||
|
}
|
||||||
|
rlEnd();
|
||||||
|
rlPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
// Define default texture used to draw shapes
|
// Define default texture used to draw shapes
|
||||||
void SetShapesTexture(Texture2D texture, Rectangle source)
|
void SetShapesTexture(Texture2D texture, Rectangle source)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue