2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Fixing more util and unsafe functions

This commit is contained in:
2021-12-18 12:47:52 +00:00
parent 4287c342a1
commit 30b47cad32
2 changed files with 305 additions and 75 deletions

View File

@@ -45,6 +45,47 @@ namespace Raylib_cs
} }
} }
/// <summary>Set shader uniform value vector</summary>
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType, int count)
where T : unmanaged
{
SetShaderValueV(shader, uniformLoc, (Span<T>)values, uniformType, count);
}
/// <summary>Set shader uniform value vector</summary>
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType, int count)
where T : unmanaged
{
fixed (T* valuePtr = values)
{
SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count);
}
}
/// <summary>Set shader uniform value</summary>
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType)
where T : unmanaged
{
SetShaderValue(shader, uniformLoc, &value, uniformType);
}
/// <summary>Set shader uniform value</summary>
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType)
where T : unmanaged
{
SetShaderValue(shader, uniformLoc, (Span<T>)values, uniformType);
}
/// <summary>Set shader uniform value</summary>
public static void SetShaderValue<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType)
where T : unmanaged
{
fixed (T* valuePtr = values)
{
SetShaderValue(shader, uniformLoc, valuePtr, uniformType);
}
}
/// <summary>Set custom trace log</summary> /// <summary>Set custom trace log</summary>
public static void SetTraceLogCallback_(TraceLogCallback callback) public static void SetTraceLogCallback_(TraceLogCallback callback)
{ {
@@ -52,6 +93,15 @@ namespace Raylib_cs
traceLogCallback = callback; traceLogCallback = callback;
} }
/// <summary>Load file data as byte array (read)</summary>
public static byte* LoadFileData(string fileName, ref uint bytesRead)
{
fixed (uint* p = &bytesRead)
{
return LoadFileData(fileName, p);
}
}
/// <summary>Get dropped files names (memory should be freed)</summary> /// <summary>Get dropped files names (memory should be freed)</summary>
public static string[] GetDroppedFiles() public static string[] GetDroppedFiles()
{ {
@@ -73,7 +123,7 @@ namespace Raylib_cs
return Utf8StringUtils.GetUTF8String(GetGamepadName(gamepad)); return Utf8StringUtils.GetUTF8String(GetGamepadName(gamepad));
} }
/// <inheritdoc cref="UpdateCamera(Camera3D*)"/> /// <summary>Update camera position for selected mode</summary>
public static void UpdateCamera(ref Camera3D camera) public static void UpdateCamera(ref Camera3D camera)
{ {
fixed (Camera3D* c = &camera) fixed (Camera3D* c = &camera)
@@ -82,6 +132,15 @@ namespace Raylib_cs
} }
} }
/// <summary>Check the collision between two lines defined by two points each, returns collision point by reference</summary>
public static CBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint)
{
fixed (Vector2* p = &collisionPoint)
{
return CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, p);
}
}
/// <summary>Create an image from text (default font)</summary> /// <summary>Create an image from text (default font)</summary>
public static Image ImageText(string text, int fontSize, Color color) public static Image ImageText(string text, int fontSize, Color color)
{ {
@@ -100,6 +159,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Convert image to POT (power-of-two)</summary>
public static void ImageToPOT(ref Image image, Color fill) public static void ImageToPOT(ref Image image, Color fill)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -108,6 +168,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Convert image data to desired format</summary>
public static void ImageFormat(ref Image image, PixelFormat newFormat) public static void ImageFormat(ref Image image, PixelFormat newFormat)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -116,6 +177,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Apply alpha mask to image</summary>
public static void ImageAlphaMask(ref Image image, Image alphaMask) public static void ImageAlphaMask(ref Image image, Image alphaMask)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -124,6 +186,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Clear alpha channel to desired color</summary>
public static void ImageAlphaClear(ref Image image, Color color, float threshold) public static void ImageAlphaClear(ref Image image, Color color, float threshold)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -132,6 +195,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Crop image depending on alpha value</summary>
public static void ImageAlphaCrop(ref Image image, float threshold) public static void ImageAlphaCrop(ref Image image, float threshold)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -140,6 +204,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Premultiply alpha channel</summary>
public static void ImageAlphaPremultiply(ref Image image) public static void ImageAlphaPremultiply(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -148,6 +213,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Crop an image to a defined rectangle</summary>
public static void ImageCrop(ref Image image, Rectangle crop) public static void ImageCrop(ref Image image, Rectangle crop)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -156,6 +222,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Resize image (Bicubic scaling algorithm)</summary>
public static void ImageResize(ref Image image, int newWidth, int newHeight) public static void ImageResize(ref Image image, int newWidth, int newHeight)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -164,6 +231,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Resize image (Nearest-Neighbor scaling algorithm)</summary>
public static void ImageResizeNN(ref Image image, int newWidth, int newHeight) public static void ImageResizeNN(ref Image image, int newWidth, int newHeight)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -172,6 +240,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Resize canvas and fill with color</summary>
public static void ImageResizeCanvas(ref Image image, int newWidth, int newHeight, int offsetX, int offsetY, Color color) public static void ImageResizeCanvas(ref Image image, int newWidth, int newHeight, int offsetX, int offsetY, Color color)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -180,6 +249,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Generate all mipmap levels for a provided image</summary>
public static void ImageMipmaps(ref Image image) public static void ImageMipmaps(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -188,6 +258,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Dither image data to 16bpp or lower (Floyd-Steinberg dithering)</summary>
public static void ImageDither(ref Image image, int rBpp, int gBpp, int bBpp, int aBpp) public static void ImageDither(ref Image image, int rBpp, int gBpp, int bBpp, int aBpp)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -196,6 +267,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Flip image vertically</summary>
public static void ImageFlipVertical(ref Image image) public static void ImageFlipVertical(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -204,6 +276,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Flip image horizontally</summary>
public static void ImageFlipHorizontal(ref Image image) public static void ImageFlipHorizontal(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -212,6 +285,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Rotate image clockwise 90deg</summary>
public static void ImageRotateCW(ref Image image) public static void ImageRotateCW(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -220,6 +294,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Rotate image counter-clockwise 90deg</summary>
public static void ImageRotateCCW(ref Image image) public static void ImageRotateCCW(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -228,6 +303,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: tint</summary>
public static void ImageColorTint(ref Image image, Color color) public static void ImageColorTint(ref Image image, Color color)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -236,6 +312,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: invert</summary>
public static void ImageColorInvert(ref Image image) public static void ImageColorInvert(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -244,6 +321,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: grayscale</summary>
public static void ImageColorGrayscale(ref Image image) public static void ImageColorGrayscale(ref Image image)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -252,6 +330,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: contrast (-100 to 100)</summary>
public static void ImageColorContrast(ref Image image, float contrast) public static void ImageColorContrast(ref Image image, float contrast)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -260,6 +339,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: brightness (-255 to 255)</summary>
public static void ImageColorBrightness(ref Image image, int brightness) public static void ImageColorBrightness(ref Image image, int brightness)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -268,6 +348,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Modify image color: replace color</summary>
public static void ImageColorReplace(ref Image image, Color color, Color replace) public static void ImageColorReplace(ref Image image, Color color, Color replace)
{ {
fixed (Image* p = &image) fixed (Image* p = &image)
@@ -276,7 +357,16 @@ namespace Raylib_cs
} }
} }
/// <inheritdoc cref="ImageDrawPixel(Image*, int, int, Color)"/> /// <summary>Clear image background with given color</summary>
public static void ImageClearBackground(ref Image dst, Color color)
{
fixed (Image* p = &dst)
{
ImageClearBackground(p, color);
}
}
/// <summary>Draw pixel within an image</summary>
public static void ImageDrawPixel(ref Image dst, int posX, int posY, Color color) public static void ImageDrawPixel(ref Image dst, int posX, int posY, Color color)
{ {
fixed (Image* p = &dst) fixed (Image* p = &dst)
@@ -285,7 +375,7 @@ namespace Raylib_cs
} }
} }
/// <inheritdoc cref="ImageDrawPixelV(Image*, Vector2, Color)"/> /// <summary>Draw pixel within an image (Vector version)</summary>
public static void ImageDrawPixelV(ref Image dst, Vector2 position, Color color) public static void ImageDrawPixelV(ref Image dst, Vector2 position, Color color)
{ {
fixed (Image* p = &dst) fixed (Image* p = &dst)
@@ -294,29 +384,211 @@ namespace Raylib_cs
} }
} }
/// <inheritdoc cref="ImageDrawText(Image*, byte*, int, int, int, Color)"/> /// <summary>Draw line within an image</summary>
public static void ImageDrawLine(ref Image dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawLine(p, startPosX, startPosY, endPosX, endPosY, color);
}
}
/// <summary>Draw line within an image (Vector version)</summary>
public static void ImageDrawLineV(ref Image dst, Vector2 start, Vector2 end, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawLineV(p, start, end, color);
}
}
/// <summary>Draw circle within an image</summary>
public static void ImageDrawCircle(ref Image dst, int centerX, int centerY, int radius, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawCircle(p, centerX, centerY, radius, color);
}
}
/// <summary>Draw circle within an image (Vector version)</summary>
public static void ImageDrawCircleV(ref Image dst, Vector2 center, int radius, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawCircleV(p, center, radius, color);
}
}
/// <summary>Draw rectangle within an image</summary>
public static void ImageDrawRectangle(ref Image dst, int posX, int posY, int width, int height, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawRectangle(p, posX, posY, width, height, color);
}
}
/// <summary>Draw rectangle within an image (Vector version)</summary>
public static void ImageDrawRectangleV(ref Image dst, Vector2 position, Vector2 size, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawRectangleV(p, position, size, color);
}
}
/// <summary>Draw rectangle within an image</summary>
public static void ImageDrawRectangleRec(ref Image dst, Rectangle rec, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawRectangleRec(p, rec, color);
}
}
/// <summary>Draw rectangle lines within an image</summary>
public static void ImageDrawRectangleLines(ref Image dst, Rectangle rec, int thick, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawRectangleLines(p, rec, thick, color);
}
}
/// <summary>Draw a source image within a destination image (tint applied to source)</summary>
public static void ImageDraw(ref Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint)
{
fixed (Image* p = &dst)
{
ImageDraw(p, src, srcRec, dstRec, tint);
}
}
/// <summary>Draw text (using default font) within an image (destination)</summary>
public static void ImageDrawText(ref Image dst, Utf8String text, int x, int y, int fontSize, Color color) public static void ImageDrawText(ref Image dst, Utf8String text, int x, int y, int fontSize, Color color)
{ {
fixed (byte* p = text) fixed (Image* p = &dst)
{ {
fixed (Image* i = &dst) fixed (byte* p1 = text)
{ {
ImageDrawText(i, p, x, y, fontSize, color); ImageDrawText(p, p1, x, y, fontSize, color);
} }
} }
} }
/// <summary>Draw text (custom sprite font) within an image (destination)</summary>
public static void ImageDrawTextEx(ref Image dst, Font font, Utf8String text, Vector2 position, int fontSize, float spacing, Color color) public static void ImageDrawTextEx(ref Image dst, Font font, Utf8String text, Vector2 position, int fontSize, float spacing, Color color)
{ {
fixed (byte* p = text) fixed (Image* p = &dst)
{ {
fixed (Image* i = &dst) fixed (byte* p1 = text)
{ {
ImageDrawTextEx(i, font, p, position, fontSize, spacing, color); ImageDrawTextEx(p, font, p1, position, fontSize, spacing, color);
} }
} }
} }
/// <summary>Generate GPU mipmaps for a texture</summary>
public static void GenTextureMipmaps(ref Texture2D texture)
{
fixed (Texture2D* p = &texture)
{
GenTextureMipmaps(p);
}
}
/// <summary>Upload vertex data into GPU and provided VAO/VBO ids</summary>
public static void UploadMesh(ref Mesh mesh, CBool dynamic)
{
fixed (Mesh* p = &mesh)
{
UploadMesh(p, dynamic);
}
}
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
public static void UnloadMesh(ref Mesh mesh)
{
fixed (Mesh* p = &mesh)
{
UnloadMesh(p);
}
}
/// <summary>Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)</summary>
public static void SetMaterialTexture(ref Material material, MaterialMapIndex mapType, Texture2D texture)
{
fixed (Material* p = &material)
{
SetMaterialTexture(p, mapType, texture);
}
}
/// <summary>Set material for a mesh</summary>
public static void SetModelMeshMaterial(ref Model model, int meshId, int materialId)
{
fixed (Model* p = &model)
{
SetModelMeshMaterial(p, meshId, materialId);
}
}
/// <summary>Load model animations from file</summary>
public static ReadOnlySpan<ModelAnimation> LoadModelAnimations(Utf8String fileName, ref uint animsCount)
{
fixed (byte* p1 = fileName)
{
fixed (uint* p2 = &animsCount)
{
var model = LoadModelAnimations(p1, p2);
if ((IntPtr)model == IntPtr.Zero)
{
throw new ApplicationException("Failed to load animation");
}
return new ReadOnlySpan<ModelAnimation>(model, (int)animsCount);
}
}
}
/// <summary>Compute mesh tangents</summary>
public static void GenMeshTangents(ref Mesh mesh)
{
fixed (Mesh* p = &mesh)
{
GenMeshTangents(p);
}
}
/// <summary>Compute mesh binormals</summary>
public static void GenMeshBinormals(ref Mesh mesh)
{
fixed (Mesh* p = &mesh)
{
GenMeshBinormals(p);
}
}
/// <summary>Convert wave data to desired format</summary>
public static void WaveFormat(ref Wave wave, int sampleRate, int sampleSize, int channels)
{
fixed (Wave* p = &wave)
{
WaveFormat(p, sampleRate, sampleSize, channels);
}
}
/// <summary>Crop a wave to defined samples range</summary>
public static void WaveCrop(ref Wave wave, int initSample, int finalSample)
{
fixed (Wave* p = &wave)
{
WaveCrop(p, initSample, finalSample);
}
}
public static void DrawText(string text, int posX, int posY, int fontSize, Color color) public static void DrawText(string text, int posX, int posY, int fontSize, Color color)
{ {
fixed (byte* p = text.GetUTF8Bytes()) fixed (byte* p = text.GetUTF8Bytes())
@@ -420,6 +692,7 @@ namespace Raylib_cs
} }
} }
/// <summary>Encode codepoint into utf8 text (char array length returned as parameter)</summary>
public static string CodepointToUTF8(int codepoint, ref int byteSize) public static string CodepointToUTF8(int codepoint, ref int byteSize)
{ {
fixed (int* l1 = &byteSize) fixed (int* l1 = &byteSize)
@@ -429,30 +702,15 @@ namespace Raylib_cs
} }
} }
/// <summary>Encode codepoint into utf8 text (char array length returned as parameter)</summary>
public static string TextCodepointsToUTF8(int[] codepoints, int length) public static string TextCodepointsToUTF8(int[] codepoints, int length)
{ {
fixed (int* c1 = codepoints) fixed (int* c1 = codepoints)
{ {
var ptr = TextCodepointsToUTF8(c1, length); var ptr = TextCodepointsToUTF8(c1, length);
return Utf8StringUtils.GetUTF8String(ptr); var text = Utf8StringUtils.GetUTF8String(ptr);
} MemFree(ptr);
} return text;
public static ReadOnlySpan<ModelAnimation> LoadModelAnimations(Utf8String fileName, ref int animsCount)
{
fixed (byte* p1 = fileName)
{
fixed (int* p2 = &animsCount)
{
var model = LoadModelAnimations(p1, p2);
if ((IntPtr)model == IntPtr.Zero)
{
throw new ApplicationException("Failed to load animation");
}
return new ReadOnlySpan<ModelAnimation>(model, animsCount);
}
} }
} }
@@ -473,48 +731,12 @@ namespace Raylib_cs
public static void SetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex, ref Texture2D texture) public static void SetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex, ref Texture2D texture)
{ {
SetMaterialTexture(&model.materials[materialIndex], (int)mapIndex, texture); SetMaterialTexture(&model.materials[materialIndex], mapIndex, texture);
} }
public static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader) public static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader)
{ {
model.materials[materialIndex].shader = shader; model.materials[materialIndex].shader = shader;
} }
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType, int count)
where T : unmanaged
{
SetShaderValueV(shader, uniformLoc, (Span<T>)values, uniformType, count);
}
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType, int count)
where T : unmanaged
{
fixed (T* valuePtr = values)
{
SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count);
}
}
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType)
where T : unmanaged
{
SetShaderValue(shader, uniformLoc, &value, uniformType);
}
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType)
where T : unmanaged
{
SetShaderValue(shader, uniformLoc, (Span<T>)values, uniformType);
}
public static void SetShaderValue<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType)
where T : unmanaged
{
fixed (T* valuePtr = values)
{
SetShaderValue(shader, uniformLoc, valuePtr, uniformType);
}
}
} }
} }

View File

@@ -511,7 +511,7 @@ namespace Raylib_cs
/// <summary>Load file data as byte array (read)</summary> /// <summary>Load file data as byte array (read)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* LoadFileData(string fileName, int* bytesRead); public static extern byte* LoadFileData(string fileName, uint* bytesRead);
/// <summary>Unload file data allocated by LoadFileData()</summary> /// <summary>Unload file data allocated by LoadFileData()</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -519,7 +519,7 @@ namespace Raylib_cs
/// <summary>Save data to file from byte array (write)</summary> /// <summary>Save data to file from byte array (write)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool SaveFileData(string fileName, void* data, int bytesToWrite); public static extern CBool SaveFileData(string fileName, void* data, uint bytesToWrite);
/// <summary>Check file extension</summary> /// <summary>Check file extension</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -541,14 +541,22 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetFileModTime(string fileName); public static extern int GetFileModTime(string fileName);
/// <summary>Compress data (DEFLATE algorythm)</summary> /// <summary>Compress data (DEFLATE algorithm)</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 dataLength, int* compDataLength);
/// <summary>Decompress data (DEFLATE algorythm)</summary> /// <summary>Decompress data (DEFLATE algorithm)</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 compDataLength, int* dataLength);
/// <summary>Encode data to Base64 string</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* EncodeDataBase64(byte[] data, int dataLength, int* outputLength);
/// <summary>Decode Base64 string data</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* DecodeDataBase64(byte[] data, int* outputLength);
// Persistent storage management // Persistent storage management
@@ -1376,7 +1384,7 @@ namespace Raylib_cs
/// <summary>Get Color structure from hexadecimal value</summary> /// <summary>Get Color structure from hexadecimal value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color GetColor(int hexValue); public static extern Color GetColor(uint hexValue);
/// <summary>Get Color from a source pixel pointer of certain format</summary> /// <summary>Get Color from a source pixel pointer of certain format</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1525,7 +1533,7 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* CodepointToUTF8(int codepoint, int* byteSize); public static extern byte* CodepointToUTF8(int codepoint, int* byteSize);
/// <summary>Encode codepoint into utf8 text (char array length returned as parameter)</summary> /// <summary>Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* TextCodepointsToUTF8(int* codepoints, int length); public static extern byte* TextCodepointsToUTF8(int* codepoints, int length);
@@ -1703,7 +1711,7 @@ namespace Raylib_cs
/// <summary>Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)</summary> /// <summary>Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMaterialTexture(Material* material, int mapType, Texture2D texture); public static extern void SetMaterialTexture(Material* material, MaterialMapIndex mapType, Texture2D texture);
/// <summary>Set material for a mesh</summary> /// <summary>Set material for a mesh</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1794,7 +1802,7 @@ namespace Raylib_cs
/// <summary>Load model animations from file</summary> /// <summary>Load model animations from file</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern ModelAnimation* LoadModelAnimations(byte* fileName, int* animsCount); public static extern ModelAnimation* LoadModelAnimations(byte* fileName, uint* animsCount);
/// <summary>Update model animation pose</summary> /// <summary>Update model animation pose</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1806,7 +1814,7 @@ namespace Raylib_cs
/// <summary>Unload animation array data</summary> /// <summary>Unload animation array data</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadModelAnimations(ModelAnimation[] animations, int count); public static extern void UnloadModelAnimations(ModelAnimation[] animations, uint count);
/// <summary>Check model animation skeleton match</summary> /// <summary>Check model animation skeleton match</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]