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

More fixes

This commit is contained in:
Rgebee 2023-03-30 19:55:11 +01:00
commit d81714dd25
2 changed files with 36 additions and 41 deletions

View file

@ -515,7 +515,7 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadFileData(byte* data); public static extern void UnloadFileData(byte* data);
/// <summary>Save data to file from byte array (write)</summary> /// <summary>Save data to file from byte array (write), returns true on success</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool SaveFileData(sbyte* fileName, void* data, uint bytesToWrite); public static extern CBool SaveFileData(sbyte* fileName, void* data, uint bytesToWrite);
@ -543,11 +543,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool DirectoryExists(sbyte* dirPath); public static extern CBool DirectoryExists(sbyte* dirPath);
/// <summary>Check file extension</summary> /// <summary>Check file extension (including point: .png, .wav)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext); public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext);
/// <summary> Get file length in bytes</summary> /// <summary>Get file length in bytes</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetFileLength(sbyte* fileName); public static extern int GetFileLength(sbyte* fileName);
@ -603,11 +603,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsFileDropped(); public static extern CBool IsFileDropped();
/// <summary>Get dropped files names (memory should be freed)</summary> /// <summary>Load dropped filepaths</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern FilePathList LoadDroppedFiles(); public static extern FilePathList LoadDroppedFiles();
/// <summary>Clear dropped files paths buffer (free memory)</summary> /// <summary>Unload dropped filepaths</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadDroppedFiles(FilePathList files); public static extern void UnloadDroppedFiles(FilePathList files);
@ -618,21 +618,21 @@ namespace Raylib_cs
// Compression/Encoding functionality // Compression/Encoding functionality
/// <summary>Compress data (DEFLATE algorithm)</summary> /// <summary>Compress data (DEFLATE algorithm), memory must be MemFree()</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Decompress data (DEFLATE algorithm)</summary> /// <summary>Decompress data (DEFLATE algorithm), memory must be MemFree()</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Encode data to Base64 string</summary> /// <summary>Encode data to Base64 string, memory must be MemFree()</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Decode Base64 string data</summary> /// <summary>Decode Base64 string data, memory must be MemFree()</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* DecodeDataBase64(byte* data, int* outputLength); public static extern byte* DecodeDataBase64(byte* data, int* outputSize);
/// <summary>Open URL with default system browser (if available)</summary> /// <summary>Open URL with default system browser (if available)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -809,19 +809,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetGesturesEnabled(Gesture flags); public static extern void SetGesturesEnabled(Gesture flags);
/// <summary>Check if a gesture have been detected</summary> /// <summary>Check if a gesture has been detected</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsGestureDetected(Gesture gesture); public static extern CBool IsGestureDetected(Gesture gesture);
/// <summary>Get latest detected gesture</summary> /// <summary>Get latest detected gesture</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Gesture GetGestureDetected(); public static extern Gesture GetGestureDetected();
/// <summary>Get touch points count</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetTouchPointsCount();
/// <summary>Get gesture hold time in milliseconds</summary> /// <summary>Get gesture hold time in milliseconds</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetGestureHoldDuration(); public static extern float GetGestureHoldDuration();
@ -919,7 +914,7 @@ namespace Raylib_cs
/// <summary>Draw lines sequence</summary> /// <summary>Draw lines sequence</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Draw a color-filled circle</summary> /// <summary>Draw a color-filled circle</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -1077,11 +1072,11 @@ namespace Raylib_cs
/// <summary>Draw a triangle fan defined by points (first vertex is the center)</summary> /// <summary>Draw a triangle fan defined by points (first vertex is the center)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Draw a triangle strip defined by points</summary> /// <summary>Draw a triangle strip defined by points</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Draw a regular polygon (Vector version)</summary> /// <summary>Draw a regular polygon (Vector version)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -1841,7 +1836,7 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadCodepoints(int* codepoints); public static extern void UnloadCodepoints(int* codepoints);
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary> /// <summary>Get total number of codepoints in a UTF8 encoded string</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetCodepointCount(sbyte* text); public static extern int GetCodepointCount(sbyte* text);
@ -1956,7 +1951,7 @@ namespace Raylib_cs
/// <summary>Draw a triangle strip defined by points</summary> /// <summary>Draw a triangle strip defined by points</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [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);
/// <summary>Draw cube</summary> /// <summary>Draw cube</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]

View file

@ -728,29 +728,29 @@ namespace Raylib_cs
} }
/// <summary>Draw lines sequence</summary> /// <summary>Draw lines sequence</summary>
public static void DrawLineStrip(Vector2[] points, int numPoints, Color color) public static void DrawLineStrip(Vector2[] points, int pointCount, Color color)
{ {
fixed (Vector2* p = points) fixed (Vector2* p = points)
{ {
DrawLineStrip(p, numPoints, color); DrawLineStrip(p, pointCount, color);
} }
} }
/// <summary>Draw a triangle fan defined by points (first vertex is the center)</summary> /// <summary>Draw a triangle fan defined by points (first vertex is the center)</summary>
public static void DrawTriangleFan(Vector2[] points, int numPoints, Color color) public static void DrawTriangleFan(Vector2[] points, int pointCount, Color color)
{ {
fixed (Vector2* p = points) fixed (Vector2* p = points)
{ {
DrawTriangleFan(p, numPoints, color); DrawTriangleFan(p, pointCount, color);
} }
} }
/// <summary>Draw a triangle strip defined by points</summary> /// <summary>Draw a triangle strip defined by points</summary>
public static void DrawTriangleStrip(Vector2[] points, int pointsCount, Color color) public static void DrawTriangleStrip(Vector2[] points, int pointCount, Color color)
{ {
fixed (Vector2* p = points) fixed (Vector2* p = points)
{ {
DrawTriangleStrip(p, pointsCount, color); DrawTriangleStrip(p, pointCount, color);
} }
} }
@ -840,36 +840,36 @@ namespace Raylib_cs
} }
} }
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary> /// <summary>Get total number of codepoints in a UTF8 encoded string</summary>
public static int GetCodepointCount(string text) public static int GetCodepointCount(string text)
{ {
using var str1 = text.ToUTF8Buffer(); using var str1 = text.ToUTF8Buffer();
return GetCodepointCount(str1.AsPointer()); return GetCodepointCount(str1.AsPointer());
} }
/// <summary>Get next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure</summary> /// <summary>Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure</summary>
/// <returns>single codepoint / "char"</returns> /// <returns>single codepoint / "char"</returns>
public static int GetCodepoint(string text, ref int bytesProcessed) public static int GetCodepoint(string text, ref int codepointSize)
{ {
using var str1 = text.ToUTF8Buffer(); using var str1 = text.ToUTF8Buffer();
fixed (int* p = &bytesProcessed) fixed (int* p = &codepointSize)
{ {
return GetCodepointNext(str1.AsPointer(), p); return GetCodepointNext(str1.AsPointer(), p);
} }
} }
/// <summary>Encode codepoint into utf8 text (char array length returned as parameter)</summary> /// <summary>Encode one codepoint into UTF-8 byte array (array length returned as parameter)</summary>
public static string CodepointToUTF8(int codepoint, ref int byteSize) public static string CodepointToUTF8(int codepoint, ref int utf8Size)
{ {
fixed (int* l1 = &byteSize) fixed (int* l1 = &utf8Size)
{ {
var ptr = CodepointToUTF8(codepoint, l1); var ptr = CodepointToUTF8(codepoint, l1);
return Utf8StringUtils.GetUTF8String(ptr); return Utf8StringUtils.GetUTF8String(ptr);
} }
} }
/// <summary>Encode codepoint into utf8 text (char array length returned as parameter)</summary> /// <summary>Load UTF-8 text encoded from codepoints array</summary>
public static string TextCodepointsToUTF8(int[] codepoints, int length) public static string LoadUTF8(int[] codepoints, int length)
{ {
fixed (int* c1 = codepoints) fixed (int* c1 = codepoints)
{ {
@ -895,11 +895,11 @@ namespace Raylib_cs
} }
/// <summary>Draw a triangle strip defined by points</summary> /// <summary>Draw a triangle strip defined by points</summary>
public static void DrawTriangleStrip3D(Vector3[] points, int pointsCount, Color color) public static void DrawTriangleStrip3D(Vector3[] points, int pointCount, Color color)
{ {
fixed (Vector3* p = points) fixed (Vector3* p = points)
{ {
DrawTriangleStrip3D(p, pointsCount, color); DrawTriangleStrip3D(p, pointCount, color);
} }
} }