mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-02 16:08:32 +00:00
[SHAPES] Make functions that draw point arrays take them as const (#4051)
* Update raylib_api.* by CI * make functions that take a pointer to an array take them as const pointers * Update raylib_api.* by CI * fix comment alignment. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -196,7 +196,7 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
||||
}
|
||||
|
||||
// Draw lines sequuence (using gl lines)
|
||||
void DrawLineStrip(Vector2 *points, int pointCount, Color color)
|
||||
void DrawLineStrip(const Vector2 *points, int pointCount, Color color)
|
||||
{
|
||||
if (pointCount < 2) return; // Security check
|
||||
|
||||
@@ -1385,7 +1385,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
||||
// Draw a triangle fan defined by points
|
||||
// NOTE: First vertex provided is the center, shared by all triangles
|
||||
// By default, following vertex should be provided in counter-clockwise order
|
||||
void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
|
||||
void DrawTriangleFan(const Vector2 *points, int pointCount, Color color)
|
||||
{
|
||||
if (pointCount >= 3)
|
||||
{
|
||||
@@ -1416,7 +1416,7 @@ void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
|
||||
|
||||
// Draw a triangle strip defined by points
|
||||
// NOTE: Every new vertex connects with previous two
|
||||
void DrawTriangleStrip(Vector2 *points, int pointCount, Color color)
|
||||
void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color)
|
||||
{
|
||||
if (pointCount >= 3)
|
||||
{
|
||||
@@ -1570,7 +1570,7 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw spline: linear, minimum 2 points
|
||||
void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color)
|
||||
void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color)
|
||||
{
|
||||
if (pointCount < 2) return;
|
||||
|
||||
@@ -1687,7 +1687,7 @@ void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color)
|
||||
}
|
||||
|
||||
// Draw spline: B-Spline, minimum 4 points
|
||||
void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color)
|
||||
void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color)
|
||||
{
|
||||
if (pointCount < 4) return;
|
||||
|
||||
@@ -1763,7 +1763,7 @@ void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color)
|
||||
}
|
||||
|
||||
// Draw spline: Catmull-Rom, minimum 4 points
|
||||
void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color)
|
||||
void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color)
|
||||
{
|
||||
if (pointCount < 4) return;
|
||||
|
||||
@@ -1829,7 +1829,7 @@ void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color co
|
||||
}
|
||||
|
||||
// Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color)
|
||||
void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color)
|
||||
{
|
||||
if (pointCount < 3) return;
|
||||
|
||||
@@ -1840,7 +1840,7 @@ void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Col
|
||||
}
|
||||
|
||||
// Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color)
|
||||
void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color)
|
||||
{
|
||||
if (pointCount < 4) return;
|
||||
|
||||
@@ -2195,7 +2195,7 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
|
||||
|
||||
// Check if point is within a polygon described by array of vertices
|
||||
// NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php
|
||||
bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount)
|
||||
bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount)
|
||||
{
|
||||
bool inside = false;
|
||||
|
||||
|
Reference in New Issue
Block a user