From d81714dd259cad535a0d2b4b6c42b3aed6f58e99 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Thu, 30 Mar 2023 19:55:11 +0100 Subject: [PATCH] More fixes --- Raylib-cs/interop/Raylib.cs | 43 +++++++++++++++------------------ Raylib-cs/types/Raylib.Utils.cs | 34 +++++++++++++------------- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs index 00e7642..019a703 100644 --- a/Raylib-cs/interop/Raylib.cs +++ b/Raylib-cs/interop/Raylib.cs @@ -515,7 +515,7 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadFileData(byte* data); - /// Save data to file from byte array (write) + /// Save data to file from byte array (write), returns true on success [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool SaveFileData(sbyte* fileName, void* data, uint bytesToWrite); @@ -543,11 +543,11 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool DirectoryExists(sbyte* dirPath); - /// Check file extension + /// Check file extension (including point: .png, .wav) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext); - /// Get file length in bytes + /// Get file length in bytes [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int GetFileLength(sbyte* fileName); @@ -603,11 +603,11 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool IsFileDropped(); - /// Get dropped files names (memory should be freed) + /// Load dropped filepaths [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern FilePathList LoadDroppedFiles(); - /// Clear dropped files paths buffer (free memory) + /// Unload dropped filepaths [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadDroppedFiles(FilePathList files); @@ -618,21 +618,21 @@ namespace Raylib_cs // Compression/Encoding functionality - /// Compress data (DEFLATE algorithm) + /// Compress data (DEFLATE algorithm), memory must be MemFree() [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern byte* CompressData(byte* data, int dataLength, int* compDataLength); + public static extern byte* CompressData(byte* data, int dataSize, int* compDataSize); - /// Decompress data (DEFLATE algorithm) + /// Decompress data (DEFLATE algorithm), memory must be MemFree() [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern byte* DecompressData(byte* compData, int compDataLength, int* dataLength); + public static extern byte* DecompressData(byte* compData, int compDataSize, int* dataSize); - /// Encode data to Base64 string + /// Encode data to Base64 string, memory must be MemFree() [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern sbyte* EncodeDataBase64(byte* data, int dataLength, int* outputLength); + public static extern sbyte* EncodeDataBase64(byte* data, int dataSize, int* outputSize); - /// Decode Base64 string data + /// Decode Base64 string data, memory must be MemFree() [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern byte* DecodeDataBase64(byte* data, int* outputLength); + public static extern byte* DecodeDataBase64(byte* data, int* outputSize); /// Open URL with default system browser (if available) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -809,19 +809,14 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SetGesturesEnabled(Gesture flags); - /// Check if a gesture have been detected + /// Check if a gesture has been detected [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool IsGestureDetected(Gesture gesture); - /// Get latest detected gesture [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Gesture GetGestureDetected(); - /// Get touch points count - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern int GetTouchPointsCount(); - /// Get gesture hold time in milliseconds [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern float GetGestureHoldDuration(); @@ -919,7 +914,7 @@ namespace Raylib_cs /// Draw lines sequence [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawLineStrip(Vector2* points, int numPoints, Color color); + public static extern void DrawLineStrip(Vector2* points, int pointCount, Color color); /// Draw a color-filled circle [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -1077,11 +1072,11 @@ namespace Raylib_cs /// Draw a triangle fan defined by points (first vertex is the center) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawTriangleFan(Vector2* points, int numPoints, Color color); + public static extern void DrawTriangleFan(Vector2* points, int pointCount, Color color); /// Draw a triangle strip defined by points [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawTriangleStrip(Vector2* points, int pointsCount, Color color); + public static extern void DrawTriangleStrip(Vector2* points, int pointCount, Color color); /// Draw a regular polygon (Vector version) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -1841,7 +1836,7 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadCodepoints(int* codepoints); - /// Get total number of characters (codepoints) in a UTF8 encoded string + /// Get total number of codepoints in a UTF8 encoded string [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int GetCodepointCount(sbyte* text); @@ -1956,7 +1951,7 @@ namespace Raylib_cs /// Draw a triangle strip defined by points [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawTriangleStrip3D(Vector3* points, int pointsCount, Color color); + public static extern void DrawTriangleStrip3D(Vector3* points, int pointCount, Color color); /// Draw cube [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs index 65053bf..46a8b60 100644 --- a/Raylib-cs/types/Raylib.Utils.cs +++ b/Raylib-cs/types/Raylib.Utils.cs @@ -728,29 +728,29 @@ namespace Raylib_cs } /// Draw lines sequence - public static void DrawLineStrip(Vector2[] points, int numPoints, Color color) + public static void DrawLineStrip(Vector2[] points, int pointCount, Color color) { fixed (Vector2* p = points) { - DrawLineStrip(p, numPoints, color); + DrawLineStrip(p, pointCount, color); } } /// Draw a triangle fan defined by points (first vertex is the center) - public static void DrawTriangleFan(Vector2[] points, int numPoints, Color color) + public static void DrawTriangleFan(Vector2[] points, int pointCount, Color color) { fixed (Vector2* p = points) { - DrawTriangleFan(p, numPoints, color); + DrawTriangleFan(p, pointCount, color); } } /// Draw a triangle strip defined by points - public static void DrawTriangleStrip(Vector2[] points, int pointsCount, Color color) + public static void DrawTriangleStrip(Vector2[] points, int pointCount, Color color) { fixed (Vector2* p = points) { - DrawTriangleStrip(p, pointsCount, color); + DrawTriangleStrip(p, pointCount, color); } } @@ -840,36 +840,36 @@ namespace Raylib_cs } } - /// Get total number of characters (codepoints) in a UTF8 encoded string + /// Get total number of codepoints in a UTF8 encoded string public static int GetCodepointCount(string text) { using var str1 = text.ToUTF8Buffer(); return GetCodepointCount(str1.AsPointer()); } - /// Get next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure + /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure /// single codepoint / "char" - public static int GetCodepoint(string text, ref int bytesProcessed) + public static int GetCodepoint(string text, ref int codepointSize) { using var str1 = text.ToUTF8Buffer(); - fixed (int* p = &bytesProcessed) + fixed (int* p = &codepointSize) { return GetCodepointNext(str1.AsPointer(), p); } } - /// Encode codepoint into utf8 text (char array length returned as parameter) - public static string CodepointToUTF8(int codepoint, ref int byteSize) + /// Encode one codepoint into UTF-8 byte array (array length returned as parameter) + public static string CodepointToUTF8(int codepoint, ref int utf8Size) { - fixed (int* l1 = &byteSize) + fixed (int* l1 = &utf8Size) { var ptr = CodepointToUTF8(codepoint, l1); return Utf8StringUtils.GetUTF8String(ptr); } } - /// Encode codepoint into utf8 text (char array length returned as parameter) - public static string TextCodepointsToUTF8(int[] codepoints, int length) + /// Load UTF-8 text encoded from codepoints array + public static string LoadUTF8(int[] codepoints, int length) { fixed (int* c1 = codepoints) { @@ -895,11 +895,11 @@ namespace Raylib_cs } /// Draw a triangle strip defined by points - public static void DrawTriangleStrip3D(Vector3[] points, int pointsCount, Color color) + public static void DrawTriangleStrip3D(Vector3[] points, int pointCount, Color color) { fixed (Vector3* p = points) { - DrawTriangleStrip3D(p, pointsCount, color); + DrawTriangleStrip3D(p, pointCount, color); } }