diff --git a/Examples/Examples.csproj b/Examples/Examples.csproj index dde1b88..cacf967 100644 --- a/Examples/Examples.csproj +++ b/Examples/Examples.csproj @@ -5,7 +5,7 @@ true Examples.Program $(MSBuildThisFileDirectory) - 12 + default enable diff --git a/Examples/Shaders/ShapesTextures.cs b/Examples/Shaders/ShapesTextures.cs index b2a3c10..2def789 100644 --- a/Examples/Shaders/ShapesTextures.cs +++ b/Examples/Shaders/ShapesTextures.cs @@ -60,7 +60,7 @@ public class ShapesTextures DrawText("USING DEFAULT SHADER", 20, 40, 10, Color.Red); DrawCircle(80, 120, 35, Color.DarkBlue); - DrawCircleGradient(80, 220, 60, Color.Green, Color.SkyBlue); + DrawCircleGradient(new Vector2(80, 220), 60, Color.Green, Color.SkyBlue); DrawCircleLines(80, 340, 80, Color.DarkBlue); diff --git a/Examples/Shapes/BasicShapes.cs b/Examples/Shapes/BasicShapes.cs index ead53d9..6846847 100644 --- a/Examples/Shapes/BasicShapes.cs +++ b/Examples/Shapes/BasicShapes.cs @@ -46,7 +46,7 @@ public class BasicShapes DrawLine(18, 42, screenWidth - 18, 42, Color.Black); DrawCircle(screenWidth / 4, 120, 35, Color.DarkBlue); - DrawCircleGradient(screenWidth / 4, 220, 60, Color.Green, Color.SkyBlue); + DrawCircleGradient(new Vector2(screenWidth / 4, 220), 60, Color.Green, Color.SkyBlue); DrawCircleLines(screenWidth / 4, 340, 80, Color.DarkBlue); DrawRectangle(screenWidth / 4 * 2 - 60, 100, 120, 60, Color.Red); diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs index d9b6a1d..1ad4343 100644 --- a/Raylib-cs/interop/Raylib.cs +++ b/Raylib-cs/interop/Raylib.cs @@ -207,7 +207,7 @@ public static unsafe partial class Raylib /// Set window configuration state using flags [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial CBool SetWindowState(ConfigFlags flag); + public static partial void SetWindowState(ConfigFlags flag); /// Clear window configuration state flags [LibraryImport(NativeLibName)] @@ -689,7 +689,7 @@ public static unsafe partial class Raylib /// Set the seed for the random number generator [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial int SetRandomSeed(uint seed); + public static partial void SetRandomSeed(uint seed); /// Load random values sequence, no values repeated [LibraryImport(NativeLibName)] @@ -870,7 +870,7 @@ public static unsafe partial class Raylib /// Get file modification time (last write time) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial long GetFileModTime(sbyte* fileName); + public static partial CLong GetFileModTime(sbyte* fileName); /// Get pointer to extension for a filename string (includes dot: '.png') [LibraryImport(NativeLibName)] @@ -930,7 +930,7 @@ public static unsafe partial class Raylib /// Load directory filepaths [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial FilePathList LoadDirectoryFiles(sbyte* dirPath, int* count); + public static partial FilePathList LoadDirectoryFiles(sbyte* dirPath); /// Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result [LibraryImport(NativeLibName)] @@ -960,12 +960,12 @@ public static unsafe partial class Raylib /// Get the file count in a directory [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial FilePathList GetDirectoryFileCount(sbyte* dirPath); + public static partial int GetDirectoryFileCount(sbyte* dirPath); /// Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial FilePathList GetDirectoryFileCountEx(sbyte* dirPath, sbyte* filter, CBool scanSubdirs); + public static partial int GetDirectoryFileCountEx(sbyte* dirPath, sbyte* filter, CBool scanSubdirs); // Compression/Encoding functionality @@ -1464,6 +1464,11 @@ public static unsafe partial class Raylib [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); + /// Draw a dashed line + [LibraryImport(NativeLibName)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); + /// Draw a color-filled circle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] @@ -1479,8 +1484,7 @@ public static unsafe partial class Raylib [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleGradient( - int centerX, - int centerY, + Vector2 center, float radius, Color inner, Color outer @@ -1879,6 +1883,11 @@ public static unsafe partial class Raylib [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageAnim(sbyte* fileName, int* frames); + /// Load image sequence from memory buffer + [LibraryImport(NativeLibName)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial Image LoadImageAnimFromMemory(sbyte* fileName, sbyte* fileData, int dataSize, int* frames); + /// Load image from memory buffer, fileType refers to extension: i.e. ".png" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] @@ -2685,6 +2694,11 @@ public static unsafe partial class Raylib [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 MeasureTextEx(Font font, sbyte* text, float fontSize, float spacing); + /// Measure string size for Font + [LibraryImport(NativeLibName)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial Vector2 MeasureTextCodepoints(Font font, int* codepoints, int length, float fontSize, float spacing); + /// /// Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found /// @@ -2816,6 +2830,16 @@ public static unsafe partial class Raylib [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextReplaceAlloc(sbyte* text, sbyte* search, sbyte* replacement); + /// Replace text between two specific strings + [LibraryImport(NativeLibName)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial sbyte* TextReplaceBetween(sbyte* text, sbyte* start, sbyte* end, sbyte* replacement); + + /// Replace text between two specific strings, (WARNING: memory must be freed!) + [LibraryImport(NativeLibName)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial sbyte* TextReplaceBetweenAlloc(sbyte* text, sbyte* start, sbyte* end, sbyte* replacement); + /// Insert text in a position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] @@ -3309,11 +3333,6 @@ public static unsafe partial class Raylib [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateModelAnimationEx(Model model, ModelAnimation anim, float frame, ModelAnimation animB, float frameB, float blend); - /// Unload animation data - [LibraryImport(NativeLibName)] - [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial void UnloadModelAnimation(ModelAnimation anim); - /// Unload animation array data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] diff --git a/Raylib-cs/interop/Raymath.cs b/Raylib-cs/interop/Raymath.cs index b8af0ca..8875d3e 100644 --- a/Raylib-cs/interop/Raymath.cs +++ b/Raylib-cs/interop/Raymath.cs @@ -296,7 +296,7 @@ public static unsafe partial class Raymath /// Calculate angle between two vectors in XY and XZ [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial Vector2 Vector3Angle(Vector3 v1, Vector3 v2); + public static partial float Vector3Angle(Vector3 v1, Vector3 v2); /// Negate provided vector (invert direction) [LibraryImport(NativeLibName)] diff --git a/Raylib-cs/interop/Rlgl.cs b/Raylib-cs/interop/Rlgl.cs index c010a63..1d3cd64 100644 --- a/Raylib-cs/interop/Rlgl.cs +++ b/Raylib-cs/interop/Rlgl.cs @@ -382,7 +382,7 @@ public static unsafe partial class Rlgl /// Blit active framebuffer to main framebuffer [LibraryImport(NativeLibName, EntryPoint = "rlBlitFramebuffer")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial void BlitFramebuffer(); + public static partial void BlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); /// Bind framebuffer (FBO) [LibraryImport(NativeLibName, EntryPoint = "rlBindFramebuffer")] @@ -594,6 +594,16 @@ public static unsafe partial class Rlgl [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial GlVersion GetVersion(); + /// Get default framebuffer width + [LibraryImport(NativeLibName, EntryPoint = "rlSetFramebufferWidth")] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial int SetFramebufferWidth(int width); + + /// Get default framebuffer width + [LibraryImport(NativeLibName, EntryPoint = "rlSetFramebufferHeight")] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + public static partial int SetFramebufferHeight(int height); + /// Get default framebuffer width [LibraryImport(NativeLibName, EntryPoint = "rlGetFramebufferWidth")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] @@ -1010,12 +1020,12 @@ public static unsafe partial class Rlgl /// Set eyes projection matrices for stereo rendering [LibraryImport(NativeLibName, EntryPoint = "rlSetMatrixProjectionStereo")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial void SetMatrixProjectionStereo(Matrix4x4 left, Matrix4x4 right); + public static partial void SetMatrixProjectionStereo(Matrix4x4 right, Matrix4x4 left); /// Set eyes view offsets matrices for stereo rendering [LibraryImport(NativeLibName, EntryPoint = "rlSetMatrixViewOffsetStereo")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial void SetMatrixViewOffsetStereo(Matrix4x4 left, Matrix4x4 right); + public static partial void SetMatrixViewOffsetStereo(Matrix4x4 right, Matrix4x4 left); // Quick and dirty cube/quad buffers load->draw->unload diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs index 859b85b..37f7bbe 100644 --- a/Raylib-cs/types/Raylib.Utils.cs +++ b/Raylib-cs/types/Raylib.Utils.cs @@ -102,7 +102,7 @@ public static unsafe partial class Raylib public static long GetFileModTime(string fileName) { using AnsiBuffer str1 = fileName.ToAnsiBuffer(); - return GetFileModTime(str1.AsPointer()); + return GetFileModTime(str1.AsPointer()).Value; } /// Load image from file into CPU memory (RAM) @@ -1699,13 +1699,10 @@ public static unsafe partial class Raylib } /// Load directory filepaths - public static FilePathList LoadDirectoryFiles(string dirPath, out int count) + public static FilePathList LoadDirectoryFiles(string dirPath) { using AnsiBuffer dirBuffer = dirPath.ToAnsiBuffer(); - int c = 0; - var result = LoadDirectoryFiles(dirBuffer.AsPointer(), &c); - count = c; - return result; + return LoadDirectoryFiles(dirBuffer.AsPointer()); } /// Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*"