2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-06-30 19:03:42 -04:00

Port to Raylib-5.0.0 (#210)

Co-authored-by: ChrisDill <chris.rj.dill@gmail.com>
This commit is contained in:
MrScautHD
2023-12-27 13:17:57 +01:00
committed by GitHub
parent ff85d9ae83
commit 43f1924faa
13 changed files with 237 additions and 26 deletions

View File

@ -75,6 +75,11 @@ public enum ConfigFlags : uint
/// </summary>
FLAG_WINDOW_MOUSE_PASSTHROUGH = 0x00004000,
/// <summary>
/// Set to run program in borderless windowed mode
/// </summary>
FLAG_BORDERLESS_WINDOWED_MODE = 0x00008000,
/// <summary>
/// Set to try enabling MSAA 4X
/// </summary>

View File

@ -79,7 +79,7 @@ public unsafe partial struct Model
/// Model animation
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public readonly unsafe partial struct ModelAnimation
public unsafe partial struct ModelAnimation
{
/// <summary>
/// Number of bones
@ -104,6 +104,11 @@ public readonly unsafe partial struct ModelAnimation
/// </summary>
public readonly Transform** FramePoses;
/// <summary>
/// Animation name (char[32])
/// </summary>
public fixed sbyte Name[32];
/// <inheritdoc cref="FramePoses"/>
public FramePosesCollection FramePosesColl => new(FramePoses, FrameCount, BoneCount);

View File

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs;

View File

@ -119,6 +119,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)
{
@ -578,6 +585,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)
{
@ -847,12 +863,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);
}
}
@ -863,14 +879,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(),
@ -878,7 +894,7 @@ public static unsafe partial class Raylib
fileData.Length,
fontSize,
fontCharsNative,
glyphCount
codepointCount
);
return font;
@ -986,6 +1002,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)
{

View File

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs;

View File

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs;