diff options
| author | gonzo <gonzo@toniatuh.com> | 2024-10-25 19:20:18 +0200 |
|---|---|---|
| committer | gonzo <gonzo@toniatuh.com> | 2024-10-25 19:20:18 +0200 |
| commit | 5e764e9edd3c5e33fa9a384b49b74e5c4eb370a3 (patch) | |
| tree | 98694af124363c3d5a40502afb49c9902e6bd842 /shapes.scm | |
| download | gambit-raylib-5e764e9edd3c5e33fa9a384b49b74e5c4eb370a3.tar.gz | |
first commit
Diffstat (limited to 'shapes.scm')
| -rw-r--r-- | shapes.scm | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/shapes.scm b/shapes.scm new file mode 100644 index 0000000..36194af --- /dev/null +++ b/shapes.scm @@ -0,0 +1,177 @@ +;; Set texture and rectangle to be used on shapes drawing +;; void SetShapesTexture(Texture2D texture, Rectangle source); + + +;;; +;;; Basic shapes drawing functions +;;; + +;; Draw a pixel +;; void DrawPixel(int posX, int posY, Color color); +(define draw-pixel + (c-lambda (int int color) void "DrawPixel")) + +;; Draw a pixel (Vector version) +;; void DrawPixelV(Vector2 position, Color color); +(define draw-pixel-V + (c-lambda (vec2 color) void "DrawPixelV")) + +;; Draw a line +;; void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); +(define draw-line + (c-lambda (int int int int color) void "DrawLine")) + +;; Draw a line (using gl lines) +;; void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); +(define draw-line-V + (c-lambda (vec2 vec2 color) void "DrawLineV")) + +;; Draw a line (using triangles/quads) +;; void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); + +;; Draw lines sequence (using gl lines) +;; void DrawLineStrip(Vector2 *points, int pointCount, Color color); + +;; Draw line segment cubic-bezier in-out interpolation +;; void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); + +;; Draw a color-filled circle +;; void DrawCircle(int centerX, int centerY, float radius, Color color); +(define draw-circle + (c-lambda (int int float color) void "DrawCircle")) + +;; Draw a piece of a circle +;; void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); + +;; Draw circle sector outline +;; void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); + +;; Draw a gradient-filled circle +;; void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); +(define draw-circle-gradient + (c-lambda (int int float color color) void "DrawCircleGradient")) + +;; Draw a color-filled circle (Vector version) +;; void DrawCircleV(Vector2 center, float radius, Color color); +(define draw-circle-V + (c-lambda (vec2 float color) void "DrawCircleV")) + +;; Draw circle outline +;; void DrawCircleLines(int centerX, int centerY, float radius, Color color); + +;; Draw circle outline (Vector version) +;; void DrawCircleLinesV(Vector2 center, float radius, Color color); + +;; Draw ellipse +;; void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); + +;; Draw ellipse outline +;; void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); + +;; Draw ring +;; void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); + +;; Draw ring outline +;; void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); + +;; Draw a color-filled rectangle +;; void DrawRectangle(int posX, int posY, int width, int height, Color color); +(define draw-rectangle + (c-lambda (int int int int color) void "DrawRectangle")) + +;; Draw a color-filled rectangle (Vector version) +;; void DrawRectangleV(Vector2 position, Vector2 size, Color color); +(define draw-rectangle-V + (c-lambda (vec2 vec2 color) void "DrawRectangleV")) + +;; Draw a color-filled rectangle +;; void DrawRectangleRec(Rectangle rec, Color color); +(define draw-rec + (c-lambda (rec color) void "DrawRectangleRec")) + +;; Draw a color-filled rectangle with pro parameters +;; void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); + +;; Draw a vertical-gradient-filled rectangle +;; void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) + +;; Draw a horizontal-gradient-filled rectangle +;; void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2) + +;; Draw a gradient-filled rectangle with custom vertex colors +;; void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); + +;; Draw rectangle outline +;; void DrawRectangleLines(int posX, int posY, int width, int height, Color color); +(define draw-rectangle-lines + (c-lambda (int int int int color) void "DrawRectangleLines")) + +;; Draw rectangle outline with extended parameters +;; void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); +(define draw-rec-lines + (c-lambda (rec float color) void "DrawRectangleLinesEx")) + +;; Draw rectangle with rounded edges +;; void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); + +;; Draw rectangle with rounded edges outline +;; void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); + +;; Draw a color-filled triangle (vertex in counter-clockwise order!) +;; void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); +(define draw-triangle + (c-lambda (vec2 vec2 vec2 color) void "DrawTriangle")) + +;; Draw triangle outline (vertex in counter-clockwise order!) +;; void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); +(define draw-triangle-lines + (c-lambda (vec2 vec2 vec2 color) void "DrawTriangleLines")) + +;; Draw a triangle fan defined by points (first vertex is the center) +;; void DrawTriangleFan(Vector2 *points, int pointCount, Color color); + +;; Draw a triangle strip defined by points +;; void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); + +;; Draw a regular polygon (Vector version) +;; void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); + +;; Draw a polygon outline of n sides +;; void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); + +;; Draw a polygon outline of n sides with extended parameters +;; void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); + + +;;; +;;; Splines drawing functions +;;; +;; Draw spline: Linear, minimum 2 points +;; 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); + +;; Draw spline: Catmull-Rom, minimum 4 points +;; void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); + +;; Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c +;; void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); + +;; Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, +;; void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); + +;; Draw spline segment: Linear, 2 points +;; void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); + +;; Draw spline segment: B-Spline, 4 points +;; void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); + +;; Draw spline segment: Catmull-Rom, 4 points +;; void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); + +;; Draw spline segment: Quadratic Bezier, 2 points, 1 control point +;; void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); + +;; Draw spline segment: Cubic Bezier, 2 points, 2 control points +;; void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); |
