From ed99ded786bc8cf429736f978946f6fc2a005a86 Mon Sep 17 00:00:00 2001
From: JupiterRider <60042618+JupiterRider@users.noreply.github.com>
Date: Fri, 6 Dec 2024 19:22:23 +0100
Subject: [PATCH] doc comments fixed and new draw methods added
---
Raylib-cs/interop/Raylib.cs | 38 ++++++++++++++++----
Raylib-cs/types/Raylib.Utils.cs | 62 ++++++++++++++++++++++++++++++++-
2 files changed, 92 insertions(+), 8 deletions(-)
diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs
index b93a37a..3881497 100644
--- a/Raylib-cs/interop/Raylib.cs
+++ b/Raylib-cs/interop/Raylib.cs
@@ -1020,11 +1020,11 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetShapesTexture(Texture2D texture, Rectangle source);
- // Get texture that is used for shapes drawing
+ /// Get texture that is used for shapes drawing
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Texture2D GetShapesTexture();
- // Get texture source rectangle that is used for shapes drawing
+ /// Get texture source rectangle that is used for shapes drawing
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Rectangle GetShapesTextureRectangle();
@@ -1228,7 +1228,7 @@ public static unsafe partial class Raylib
Color color
);
- // Draw rectangle with rounded edges outline
+ /// Draw rectangle with rounded edges outline
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawRectangleRoundedLinesEx(
Rectangle rec,
@@ -1356,7 +1356,7 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
- // Check if circle collides with a line created betweeen two points [p1] and [p2]
+ /// Check if circle collides with a line created betweeen two points [p1] and [p2]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2);
@@ -1524,7 +1524,7 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image ImageFromImage(Image image, Rectangle rec);
- // Create an image from a selected channel of another image (GRAYSCALE)
+ /// Create an image from a selected channel of another image (GRAYSCALE)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image ImageFromChannel(Image image, int selectedChannel);
@@ -1568,7 +1568,7 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageBlurGaussian(Image* image, int blurSize);
- // Apply custom square convolution kernel to image
+ /// Apply custom square convolution kernel to image
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageKernelConvolution(Image* image, float* kernel, int kernelSize);
@@ -1698,6 +1698,10 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawLineV(Image* dst, Vector2 start, Vector2 end, Color color);
+ /// Draw a line defining thickness within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawLineEx(Image* dst, Vector2 start, Vector2 end, int thick, Color color);
+
/// Draw circle within an image
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color);
@@ -1737,6 +1741,26 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawRectangleLines(Image* dst, Rectangle rec, int thick, Color color);
+ /// Draw triangle within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangle(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
+
+ /// Draw triangle with interpolated colors within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleEx(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3);
+
+ /// Draw triangle outline within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleLines(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
+
+ /// Draw a triangle fan defined by points within an image (first vertex is the center)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleFan(Image* dst, Vector2* points, int pointCount, Color color);
+
+ /// Draw a triangle strip defined by points within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleStrip(Image* dst, Vector2* points, int pointCount, Color color);
+
/// Draw a source image within a destination image (tint applied to source)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDraw(Image* dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint);
@@ -2129,7 +2153,7 @@ public static unsafe partial class Raylib
// Text strings management functions (no UTF-8 strings, only byte chars)
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
- // Copy one string to another, returns bytes copied
+ /// Copy one string to another, returns bytes copied
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TextCopy(sbyte* dst, sbyte* src);
diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs
index 97608ab..04cf58c 100644
--- a/Raylib-cs/types/Raylib.Utils.cs
+++ b/Raylib-cs/types/Raylib.Utils.cs
@@ -507,7 +507,7 @@ public static unsafe partial class Raylib
}
}
- // Apply custom square convolution kernel to image
+ /// Apply custom square convolution kernel to image
public static void ImageKernelConvolution(ref Image image, float[] kernel)
{
fixed (Image* imagePtr = &image)
@@ -731,6 +731,15 @@ public static unsafe partial class Raylib
}
}
+ /// Draw a line defining thickness within an image
+ public static void ImageDrawLineEx(ref Image dst, Vector2 start, Vector2 end, int thick, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawLineEx(p, start, end, thick, color);
+ }
+ }
+
/// Draw circle within an image
public static void ImageDrawCircle(ref Image dst, int centerX, int centerY, int radius, Color color)
{
@@ -785,6 +794,57 @@ public static unsafe partial class Raylib
}
}
+ /// Draw triangle within an image
+ public static void ImageDrawTriangle(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangle(p, v1, v2, v3, color);
+ }
+ }
+
+ /// Draw triangle with interpolated colors within an image
+ public static void ImageDrawTriangleEx(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangleEx(p, v1, v2, v3, c1, c2, c3);
+ }
+ }
+
+ /// Draw triangle outline within an image
+ public static void ImageDrawTriangleLines(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangleLines(p, v1, v2, v3, color);
+ }
+ }
+
+ /// Draw a triangle fan defined by points within an image (first vertex is the center)
+ public static void ImageDrawTriangleFan(ref Image dst, Vector2[] points, Color color)
+ {
+ fixed (Image* imagePtr = &dst)
+ {
+ fixed (Vector2* vec2Ptr = points)
+ {
+ ImageDrawTriangleFan(imagePtr, vec2Ptr, points.Length, color);
+ }
+ }
+ }
+
+ /// Draw a triangle strip defined by points within an image
+ public static void ImageDrawTriangleStrip(ref Image dst, Vector2[] points, Color color)
+ {
+ fixed (Image* imagePtr = &dst)
+ {
+ fixed (Vector2* vec2Ptr = points)
+ {
+ ImageDrawTriangleStrip(imagePtr, vec2Ptr, points.Length, color);
+ }
+ }
+ }
+
/// Draw a source image within a destination image (tint applied to source)
public static void ImageDraw(ref Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint)
{