Watch
2
0
Fork
You've already forked raylib-cs
0

Update Raylib.Utils

This commit is contained in:
MrScautHD 2023-11-19 13:34:27 +01:00
commit 10d7df07d3
2 changed files with 79 additions and 9 deletions

View file

@ -83,6 +83,15 @@ public static unsafe partial class Raylib
return GetShaderLocationAttrib(shader, str1.AsPointer());
}
/// <summary>Unload random values sequence</summary>
public static void UnloadRandomSequence(out int sequence)
{
fixed (int* p = &sequence)
{
UnloadRandomSequence(p);
}
}
/// <summary>Takes a screenshot of current screen (saved a .png)</summary>
public static void TakeScreenshot(string fileName)
{
@ -119,6 +128,13 @@ public static unsafe partial class Raylib
return LoadImageRaw(str1.AsPointer(), width, height, format, headerSize);
}
/// <summary>Load image sequence from file (frames appended to image.data)</summary>
public static Image LoadImageSvg(string fileName, int width, int height)
{
using var str1 = fileName.ToAnsiBuffer();
return LoadImageSvg(str1.AsPointer(), width, height);
}
/// <summary>Load image sequence from file (frames appended to image.data)</summary>
public static Image LoadImageAnim(string fileName, out int frames)
{
@ -571,6 +587,15 @@ public static unsafe partial class Raylib
}
}
/// <summary>Rotate image by input angle in degrees (-359 to 359)</summary>
public static void ImageRotate(ref Image image, int degrees)
{
fixed (Image* p = &image)
{
ImageRotate(p, degrees);
}
}
/// <summary>Rotate image clockwise 90deg</summary>
public static void ImageRotateCW(ref Image image)
{
@ -840,12 +865,12 @@ public static unsafe partial class Raylib
}
/// <summary>Load font from file with extended parameters</summary>
public static Font LoadFontEx(string fileName, int fontSize, int[] fontChars, int glyphCount)
public static Font LoadFontEx(string fileName, int fontSize, int[] codepoints, int codepointCount)
{
using var str1 = fileName.ToAnsiBuffer();
fixed (int* p = fontChars)
fixed (int* p = codepoints)
{
return LoadFontEx(str1.AsPointer(), fontSize, p, glyphCount);
return LoadFontEx(str1.AsPointer(), fontSize, p, codepointCount);
}
}
@ -856,14 +881,14 @@ public static unsafe partial class Raylib
string fileType,
byte[] fileData,
int fontSize,
int[] fontChars,
int glyphCount
int[] codepoints,
int codepointCount
)
{
using var fileTypeNative = fileType.ToAnsiBuffer();
fixed (byte* fileDataNative = fileData)
{
fixed (int* fontCharsNative = fontChars)
fixed (int* fontCharsNative = codepoints)
{
Font font = LoadFontFromMemory(
fileTypeNative.AsPointer(),
@ -871,7 +896,7 @@ public static unsafe partial class Raylib
fileData.Length,
fontSize,
fontCharsNative,
glyphCount
codepointCount
);
return font;
@ -979,6 +1004,51 @@ public static unsafe partial class Raylib
}
}
/// <summary>Draw spline: Linear, minimum 2 points</summary>
public static void DrawSplineLinear(Vector2[] points, int pointCount, float thick, Color color)
{
fixed (Vector2* p = points)
{
DrawSplineLinear(p, pointCount, thick, color);
}
}
/// <summary>Draw spline: B-Spline, minimum 4 points</summary>
public static void DrawSplineBasis(Vector2[] points, int pointCount, float thick, Color color)
{
fixed (Vector2* p = points)
{
DrawSplineBasis(p, pointCount, thick, color);
}
}
/// <summary>Draw spline: Catmull-Rom, minimum 4 points</summary>
public static void DrawSplineCatmullRom(Vector2[] points, int pointCount, float thick, Color color)
{
fixed (Vector2* p = points)
{
DrawSplineCatmullRom(p, pointCount, thick, color);
}
}
/// <summary>Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]</summary>
public static void DrawSplineBezierQuadratic(Vector2[] points, int pointCount, float thick, Color color)
{
fixed (Vector2* p = points)
{
DrawSplineBezierQuadratic(p, pointCount, thick, color);
}
}
/// <summary>Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]</summary>
public static void DrawSplineBezierCubic(Vector2[] points, int pointCount, float thick, Color color)
{
fixed (Vector2* p = points)
{
DrawSplineBezierCubic(p, pointCount, thick, color);
}
}
/// <summary>Draw text (using default font)</summary>
public static void DrawText(string text, int posX, int posY, int fontSize, Color color)
{