Add const modifier to drawing API
This commit is contained in:
parent
36df9c5bd6
commit
c4df1479ca
20
src/raylib.h
20
src/raylib.h
|
|
@ -1227,7 +1227,7 @@ RLAPI void DrawPixelV(Vector2 position, Color color);
|
||||||
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
||||||
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
||||||
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
||||||
RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||||
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
||||||
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
||||||
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
||||||
|
|
@ -1253,18 +1253,18 @@ RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Co
|
||||||
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
|
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
|
||||||
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
||||||
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
|
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
|
||||||
RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
RLAPI void DrawTriangleFan(const 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 DrawTriangleStrip(const 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 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 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 DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
|
||||||
|
|
||||||
// Splines drawing functions
|
// Splines drawing functions
|
||||||
RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||||
RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
||||||
RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
||||||
RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||||
RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||||
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
|
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
|
||||||
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
|
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
|
||||||
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
|
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
|
||||||
|
|
@ -1285,7 +1285,7 @@ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
|
||||||
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
|
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
|
||||||
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
|
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
|
||||||
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
|
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
|
||||||
RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
RLAPI bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
||||||
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
|
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
|
||||||
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
||||||
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
|
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
|
||||||
|
|
@ -1491,7 +1491,7 @@ RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color);
|
||||||
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
||||||
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||||
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
||||||
RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||||
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a triangle strip defined by points
|
// Draw a triangle strip defined by points
|
||||||
void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color)
|
void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color)
|
||||||
{
|
{
|
||||||
if (pointCount < 3) return;
|
if (pointCount < 3) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw lines sequuence (using gl lines)
|
// 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)
|
if (pointCount >= 2)
|
||||||
{
|
{
|
||||||
|
|
@ -1363,7 +1363,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
||||||
// Draw a triangle fan defined by points
|
// Draw a triangle fan defined by points
|
||||||
// NOTE: First vertex provided is the center, shared by all triangles
|
// NOTE: First vertex provided is the center, shared by all triangles
|
||||||
// By default, following vertex should be provided in counter-clockwise order
|
// 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)
|
if (pointCount >= 3)
|
||||||
{
|
{
|
||||||
|
|
@ -1392,7 +1392,7 @@ void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
|
||||||
|
|
||||||
// Draw a triangle strip defined by points
|
// Draw a triangle strip defined by points
|
||||||
// NOTE: Every new vertex connects with previous two
|
// 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)
|
if (pointCount >= 3)
|
||||||
{
|
{
|
||||||
|
|
@ -1544,7 +1544,7 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw spline: linear, minimum 2 points
|
// 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;
|
if (pointCount < 2) return;
|
||||||
|
|
||||||
|
|
@ -1661,7 +1661,7 @@ void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw spline: B-Spline, minimum 4 points
|
// 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;
|
if (pointCount < 4) return;
|
||||||
|
|
||||||
|
|
@ -1737,7 +1737,7 @@ void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw spline: Catmull-Rom, minimum 4 points
|
// 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;
|
if (pointCount < 4) return;
|
||||||
|
|
||||||
|
|
@ -1803,7 +1803,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...]
|
// 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;
|
if (pointCount < 3) return;
|
||||||
|
|
||||||
|
|
@ -1814,7 +1814,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...]
|
// 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;
|
if (pointCount < 4) return;
|
||||||
|
|
||||||
|
|
@ -2169,7 +2169,7 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
|
||||||
|
|
||||||
// Check if point is within a polygon described by array of vertices
|
// Check if point is within a polygon described by array of vertices
|
||||||
// NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php
|
// 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 collision = false;
|
bool collision = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user