diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a847856..6fed410 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: branches: [ "main" ] env: - raylib_version: 'a8240722c61d216d96c3f2cab27426ee7b7a3919' + raylib_version: '5.5' jobs: @@ -34,7 +34,7 @@ jobs: - name: Build Raylib shell: bash run: | - curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/${{ env.raylib_version }}.zip + curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip unzip -qq raylib.zip cmake -S raylib-${{ env.raylib_version }} \ -A ${{ matrix.name }} \ @@ -93,7 +93,7 @@ jobs: # Build Raylib - name: Build Raylib run: | - curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/${{ env.raylib_version }}.zip + curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip unzip -qq raylib.zip cmake -S raylib-${{ env.raylib_version }} \ -B native \ @@ -134,7 +134,7 @@ jobs: # Build Raylib - name: Build Raylib run: | - curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/${{ env.raylib_version }}.zip + curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip unzip -qq raylib.zip cmake -S raylib-${{ env.raylib_version }} \ -B native \ diff --git a/README.md b/README.md index 211a4ae..2178b11 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Unlock advanced rendering capabilities with [Bliss](https://github.com/MrScautHD # 🪙 Installation - [Nuget](https://www.nuget.org/packages/Raylib-CSharp) ``` -dotnet add package Raylib-CSharp --version 4.1.9 +dotnet add package Raylib-CSharp --version 5.0.0 ``` # 📖 [Installation - From source] @@ -73,7 +73,7 @@ dotnet add package Raylib-CSharp --version 4.1.9 | .NET 5.0, 6.0 / C# 10 | .NET 8.0 / C# 12 | | Released 2018-07 | Released 2024-05 | | License ZLib | License MIT | -| Raylib 5.0 | Raylib 5.1-dev | +| Raylib 5.0 | Raylib 5.5 | # ✍️ Acknowledgement This library is available under the [MIT](https://choosealicense.com/licenses/mit) license. diff --git a/src/Raylib-CSharp.Samples/CMake.props b/src/Raylib-CSharp.Samples/CMake.props index 2d4455e..38165da 100644 --- a/src/Raylib-CSharp.Samples/CMake.props +++ b/src/Raylib-CSharp.Samples/CMake.props @@ -1,6 +1,6 @@ - a8240722c61d216d96c3f2cab27426ee7b7a3919 + 5.5 @@ -15,11 +15,10 @@ libraylib.dylib - @@ -58,4 +57,4 @@ PreserveNewest - \ No newline at end of file + diff --git a/src/Raylib-CSharp.Test/CMake.props b/src/Raylib-CSharp.Test/CMake.props index 5321202..b61490a 100644 --- a/src/Raylib-CSharp.Test/CMake.props +++ b/src/Raylib-CSharp.Test/CMake.props @@ -1,6 +1,6 @@ - a8240722c61d216d96c3f2cab27426ee7b7a3919 + 5.5 @@ -15,11 +15,10 @@ libraylib.dylib - @@ -58,4 +57,4 @@ PreserveNewest - \ No newline at end of file + diff --git a/src/Raylib-CSharp.Test/Program.cs b/src/Raylib-CSharp.Test/Program.cs index 08bf205..8d8a567 100644 --- a/src/Raylib-CSharp.Test/Program.cs +++ b/src/Raylib-CSharp.Test/Program.cs @@ -1,4 +1,5 @@ using System.Numerics; +using System.Text; using OpenTK.Graphics; using Raylib_CSharp.Camera.Cam3D; using Raylib_CSharp.Colors; @@ -77,8 +78,12 @@ Console.WriteLine(info.Length + ""); Image image = Font.GenImageAtlas(info, font.Recs, 18, 4, 0); +Image clipboardImage = Window.GetClipboardImage(); //Not suported on all platforms Texture2D texture = Texture2D.LoadFromImage(image); +Texture2D clipboardTexture = Texture2D.LoadFromImage(clipboardImage); image.Unload(); +clipboardImage.Unload(); + FileManager.UnloadFileData(fileData); TextManager.UnloadCodepoints(codepoints); @@ -104,7 +109,7 @@ Font font2 = Font.GetDefault(); -//if (font2.IsReady()) { +//if (font2.IsValid()) { // //} @@ -112,6 +117,18 @@ NativeBindingsContext context = new NativeBindingsContext(); GLLoader.LoadBindings(context); +Console.WriteLine($"Bones:{model.Meshes[0].BoneCount}"); +Console.WriteLine($"BoneMatrices:{model.Meshes[0].BoneMatrices[0]}"); +var dataToEncode = Encoding.ASCII.GetBytes("This is a test"); +Console.WriteLine($"CRC32 Checksum:{FileManager.ComputeCRC32(dataToEncode)}"); //As ISO-HDLC + +uint[] md5Hash = FileManager.ComputeMD5(dataToEncode); +string hexString = string.Join("", md5Hash.Select(x => x.ToString("x8"))); +Console.WriteLine($"MD5 Checksum: {hexString}"); + +uint[] sha1Hash = FileManager.ComputeSHA1(dataToEncode); +hexString = string.Join("", sha1Hash.Select(x => x.ToString("x8"))); +Console.WriteLine($"SHA1 Checksum: {hexString}"); //Span matrix = new(new Matrix4x4[1]); //matrix[1] = new Matrix4x4(); @@ -133,6 +150,7 @@ Graphics.DrawFPS(50, 50); Graphics.DrawTexture(texture, 10, 10, Color.White); + Graphics.DrawTexture(clipboardTexture, 128, 128, Color.White); Graphics.EndDrawing(); } diff --git a/src/Raylib-CSharp/Apis/RaylibApi.cs b/src/Raylib-CSharp/Apis/RaylibApi.cs index 1bd086d..5149007 100644 --- a/src/Raylib-CSharp/Apis/RaylibApi.cs +++ b/src/Raylib-CSharp/Apis/RaylibApi.cs @@ -507,6 +507,14 @@ internal static partial class RaylibApi { [return: MarshalUsing(typeof(NonFreeUtf8StringMarshaller))] internal static partial string GetClipboardText(); + /// + /// Get clipboard image. + /// + /// The image stored in the clipboard as an Image. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static partial Image GetClipboardImage(); + /// /// Enable waiting for events on EndDrawing(), no automatic event polling. /// @@ -1019,6 +1027,30 @@ internal static partial class RaylibApi { [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static partial void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); + /// + /// Draw a model points (with texture if set). + /// + /// The model to draw the points of. + /// The position at which to draw the model. + /// The scale at which to draw the model. + /// The tint color to apply to the model. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static partial void DrawModelPoints(Model model, Vector3 position, float scale, Color tint); + + /// + /// Draw a model points (with texture if set) with extended parameters. + /// + /// The model to draw. + /// The position to place the model. + /// The rotation axis to apply to the model. + /// The rotation angle to apply to the model. + /// The scale to apply to the model. + /// The color tint to apply to the model. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static partial void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); + /// /// Draw a model wires (with texture if set). /// @@ -1052,17 +1084,18 @@ internal static partial class RaylibApi { [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static partial void DrawBoundingBox(BoundingBox box, Color color); + /// /// Draw a billboard texture. /// /// The camera used for rendering. /// The texture to be drawn as a billboard. /// The position of the billboard in 3D space. - /// The size of the billboard. + /// The size of the billboard. /// The tint color of the billboard. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void DrawBillboard(Camera3D camera, Texture2D texture, Vector3 position, float size, Color tint); + internal static partial void DrawBillboard(Camera3D camera, Texture2D texture, Vector3 position, float scale, Color tint); /// /// Draw a billboard texture defined by source. @@ -1211,11 +1244,11 @@ internal static partial class RaylibApi { /// The x-coordinate of the circle's center. /// The y-coordinate of the circle's center. /// The radius of the circle. - /// The color at the center of the circle. - /// The color at the edge of the circle. + /// The color at the center of the circle. + /// The color at the edge of the circle. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); + internal static partial void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); /// /// Draw a color-filled circle (Vector version). @@ -1349,11 +1382,11 @@ internal static partial class RaylibApi { /// The Y coordinate of the rectangle's top-left corner. /// The width of the rectangle. /// The height of the rectangle. - /// The starting color of the gradient. - /// The ending color of the gradient. + /// The starting color of the gradient. + /// The ending color of the gradient. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); + internal static partial void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); /// /// Draw a horizontal-gradient-filled rectangle. @@ -1362,23 +1395,23 @@ internal static partial class RaylibApi { /// The starting y-coordinate of the rectangle. /// The width of the rectangle. /// The height of the rectangle. - /// The starting color of the gradient. - /// The ending color of the gradient. + /// The starting color of the gradient. + /// The ending color of the gradient. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2); + internal static partial void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); /// /// Draw a gradient-filled rectangle with custom vertex colors. /// /// The position and size of the rectangle. - /// The color at the top-left corner of the rectangle. - /// The color at the top-right corner of the rectangle. - /// The color at the bottom-right corner of the rectangle. - /// The color at the bottom-left corner of the rectangle. + /// + /// + /// + /// [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); + internal static partial void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); /// /// Draw rectangle outline. @@ -1746,14 +1779,14 @@ internal static partial class RaylibApi { internal static partial Shader LoadShaderFromMemory(string vsCode, string fsCode); /// - /// Check if a shader is ready. + /// Check if a shader is valid. /// /// The shader to check. - /// True if the shader is ready; otherwise, false. + /// True if the shader is valid (loaded on GPU); otherwise, false. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsShaderReady(Shader shader); + internal static partial bool IsShaderValid(Shader shader); /// /// Unload shader from GPU memory (VRAM). @@ -2275,9 +2308,10 @@ internal static partial class RaylibApi { /// The index of the gamepad. /// The intensity of the left motor vibration (0.0f to 1.0f). /// The intensity of the right motor vibration (0.0f to 1.0f). + /// The intensity of the right motor vibration (0.0f to 1.0f). [LibraryImport(Raylib.Name, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor); + internal static partial void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); /// /// Check if a mouse button has been pressed once. @@ -2776,6 +2810,16 @@ internal static partial class RaylibApi { [return: MarshalAs(UnmanagedType.I1)] internal static partial bool ChangeDirectory(string dir); + /// + /// Create directories + /// + /// The path to the new directory. + /// True if the directory was created successfully, false otherwise. + [LibraryImport(Raylib.Name, StringMarshalling = StringMarshalling.Utf8)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + [return: MarshalAs(UnmanagedType.I1)] + internal static partial bool MakeDirectory(string dir); + /// /// Check if a given path is a file or a directory. /// @@ -2902,6 +2946,37 @@ internal static partial class RaylibApi { [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static unsafe partial byte* DecodeDataBase64(byte* data, out int outputSize); + /// + /// Compute data's CRC32 + /// + /// A pointer to target data. + /// Target data size. + /// A pointer to the decoded byte array. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static unsafe partial uint ComputeCRC32(byte* data, int dataSize); + + /// + /// Compute data's MD5 + /// + /// A pointer to target data. + /// Target data size. + /// A pointer to the decoded byte array. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static unsafe partial uint* ComputeMD5(byte* data, int dataSize); + + /// + /// Compute data's SHA1 + /// + /// A pointer to target data. + /// Target data size. + /// A pointer to the decoded byte array. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static unsafe partial uint* ComputeSHA1(byte* data, int dataSize); + + /* --------------------------------- Automation Event --------------------------------- */ /// @@ -3044,14 +3119,14 @@ internal static partial class RaylibApi { internal static unsafe partial void UnloadWaveSamples(float* samples); /// - /// Checks if wave data is ready. + /// Checks if wave data is valid. /// /// The wave structure to check. - /// True if the wave data is ready; otherwise, false. + /// True if the wave data is valid (data loaded and parameters); otherwise, false. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsWaveReady(Wave wave); + internal static partial bool IsWaveValid(Wave wave); /// /// Unload wave data. @@ -3152,14 +3227,14 @@ internal static partial class RaylibApi { internal static partial Sound LoadSoundAlias(Sound source); /// - /// Checks if a sound is ready. + /// Checks if a sound is valid. /// /// The sound to check. - /// True if the sound is ready to be played, false otherwise. + /// True if the sound is valid (data loaded and buffers initialized), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsSoundReady(Sound sound); + internal static partial bool IsSoundValid(Sound sound); /// /// Update sound buffer with new data. @@ -3279,14 +3354,14 @@ internal static partial class RaylibApi { internal static unsafe partial Music LoadMusicStreamFromMemory(string fileType, byte* data, int dataSize); /// - /// Checks if a music stream is ready. + /// Checks if a music stream is valid. /// /// The music stream to check. - /// True if the music stream is ready, false otherwise. + /// True if the music stream is valid (context and buffers initialized), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsMusicReady(Music music); + internal static partial bool IsMusicValid(Music music); /// /// Unload music stream. @@ -3465,14 +3540,14 @@ internal static partial class RaylibApi { internal static unsafe partial void DetachAudioMixedProcessor(delegate* unmanaged[Cdecl] processor); /// - /// Checks if an audio stream is ready. + /// Checks if an audio stream is valid. /// /// The audio stream to check. - /// True if the audio stream is ready, false otherwise. + /// True if the audio stream is valid (buffers initialized), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsAudioStreamReady(AudioStream stream); + internal static partial bool IsAudioStreamValid(AudioStream stream); /// /// Unload audio stream and free memory. @@ -3832,12 +3907,12 @@ internal static partial class RaylibApi { /// /// Load image sequence from file (frames appended to image.data). /// - /// The name of the file or string to load the image as animation from. + /// The name of the file or string to load the image as animation from. /// Number of frames loaded. /// The loaded image as animation. [LibraryImport(Raylib.Name, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - internal static partial Image LoadImageAnim(string fileNameOrString, out int frames); + internal static partial Image LoadImageAnim(string fileName, out int frames); /// /// Load animated image data. @@ -4040,14 +4115,14 @@ internal static partial class RaylibApi { internal static unsafe partial void UnloadImagePalette(Color* colors); /// - /// Check if an image is ready. + /// Check if an image is valid. /// /// The image to check. - /// True if the image is ready; otherwise, false. + /// True if the image is valid (data and parameters); otherwise, false. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsImageReady(Image image); + internal static partial bool IsImageValid(Image image); /// /// Unload image from CPU memory (RAM). @@ -4668,14 +4743,14 @@ internal static partial class RaylibApi { internal static partial Texture2D LoadTextureCubemap(Image image, CubemapLayout layout); /// - /// Check if a texture is ready. + /// Check if a texture is valid. /// /// The texture to check. - /// Returns true if the texture is ready, false otherwise. + /// Returns true if the texture is valid (loaded in GPU), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsTextureReady(Texture2D texture); + internal static partial bool IsTextureValid(Texture2D texture); /// /// Unload texture from GPU memory (VRAM). @@ -4743,14 +4818,14 @@ internal static partial class RaylibApi { internal static partial RenderTexture2D LoadRenderTexture(int width, int height); /// - /// Check if a render texture is ready. + /// Check if a render texture is valid. /// /// The render texture to check. - /// Returns true if the render texture is ready, false otherwise. + /// Returns true if the render texture is valid (loaded in GPU), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsRenderTextureReady(RenderTexture2D target); + internal static partial bool IsRenderTextureValid(RenderTexture2D target); /// /// Unload render texture from GPU memory (VRAM). @@ -4881,6 +4956,17 @@ internal static partial class RaylibApi { [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static partial Color ColorAlphaBlend(Color dst, Color src, Color tint); + /// + /// Get color lerp interpolation between two colors. + /// + /// The first color. + /// The second color. + /// Color factor (0.0f-1.0f). + /// The interpolated color. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static partial Color ColorLerp(Color color1, Color color2, float factor); + /// /// Get Color structure from hexadecimal value. /// @@ -5015,14 +5101,14 @@ internal static partial class RaylibApi { internal static unsafe partial void UnloadFontData(GlyphInfo* glyphs, int glyphCount); /// - /// Check if a font is ready. + /// Check if a font is valid. /// /// The font to check. - /// True if the font is ready to be used, false otherwise. + /// True if the font is valid (font data loaded, WARNING: GPU texture not checked), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsFontReady(Font font); + internal static partial bool IsFontValid(Font font); /// /// Unload font from GPU memory (VRAM). @@ -5683,14 +5769,14 @@ internal static partial class RaylibApi { internal static partial RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); /// - /// Check if a model is ready. + /// Check if a model is valid. /// /// The model to check. - /// True if the model is ready, false otherwise. + /// True if the model is valid (loaded in GPU, VAO/VBOs), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsModelReady(Model model); + internal static partial bool IsModelValid(Model model); /// /// Unload model (including meshes) from memory (RAM and/or VRAM). @@ -5750,6 +5836,16 @@ internal static partial class RaylibApi { [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static partial void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); + /// + /// Update model animation mesh bone matrices. + /// + /// The model containing the animation. + /// The animation to update. + /// The frame to update the animation to. + [LibraryImport(Raylib.Name)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] + internal static partial void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame); + /// /// Check model animation skeleton match. /// @@ -5790,14 +5886,14 @@ internal static partial class RaylibApi { internal static partial Material LoadMaterialDefault(); /// - /// Check if a material is ready. + /// Check if a material is valid. /// /// The material to check. - /// True if the material is ready, false otherwise. + /// True if the material is valid (shader assigned, map textures loaded in GPU), false otherwise. [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [return: MarshalAs(UnmanagedType.I1)] - internal static partial bool IsMaterialReady(Material material); + internal static partial bool IsMaterialValid(Material material); /// /// Unload material from GPU memory (VRAM). @@ -5806,4 +5902,4 @@ internal static partial class RaylibApi { [LibraryImport(Raylib.Name)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] internal static partial void UnloadMaterial(Material material); -} \ No newline at end of file +} diff --git a/src/Raylib-CSharp/Audio/AudioStream.cs b/src/Raylib-CSharp/Audio/AudioStream.cs index 777580a..33cd8f3 100644 --- a/src/Raylib-CSharp/Audio/AudioStream.cs +++ b/src/Raylib-CSharp/Audio/AudioStream.cs @@ -66,9 +66,9 @@ public static unsafe void DetachMixedProcessor(delegate* unmanaged[Cdecl] - public bool IsReady() { - return RaylibApi.IsAudioStreamReady(this); + /// + public bool IsValid() { + return RaylibApi.IsAudioStreamValid(this); } /// diff --git a/src/Raylib-CSharp/Audio/Music.cs b/src/Raylib-CSharp/Audio/Music.cs index 64911f1..fe6eda7 100644 --- a/src/Raylib-CSharp/Audio/Music.cs +++ b/src/Raylib-CSharp/Audio/Music.cs @@ -43,9 +43,9 @@ public static unsafe Music LoadFromMemory(string fileType, ReadOnlySpan da } } - /// - public bool IsReady() { - return RaylibApi.IsMusicReady(this); + /// + public bool IsValid() { + return RaylibApi.IsMusicValid(this); } /// diff --git a/src/Raylib-CSharp/Audio/Sound.cs b/src/Raylib-CSharp/Audio/Sound.cs index 513cf6a..ed814a6 100644 --- a/src/Raylib-CSharp/Audio/Sound.cs +++ b/src/Raylib-CSharp/Audio/Sound.cs @@ -31,9 +31,9 @@ public static Sound LoadAlias(Sound source) { return RaylibApi.LoadSoundAlias(source); } - /// - public bool IsReady() { - return RaylibApi.IsSoundReady(this); + /// + public bool IsValid() { + return RaylibApi.IsSoundValid(this); } /// diff --git a/src/Raylib-CSharp/Audio/Wave.cs b/src/Raylib-CSharp/Audio/Wave.cs index f9b4578..598d8d9 100644 --- a/src/Raylib-CSharp/Audio/Wave.cs +++ b/src/Raylib-CSharp/Audio/Wave.cs @@ -50,9 +50,9 @@ public static unsafe void UnloadSamples(ReadOnlySpan samples) { } } - /// - public bool IsReady() { - return RaylibApi.IsWaveReady(this); + /// + public bool IsValid() { + return RaylibApi.IsWaveValid(this); } /// @@ -76,8 +76,8 @@ public Wave Copy() { } /// - public void Crop(int initSample, int finalSample) { - RaylibApi.WaveCrop(ref this, initSample, finalSample); + public void Crop(int initFrame, int finalFrame) { + RaylibApi.WaveCrop(ref this, initFrame, finalFrame); } /// @@ -87,6 +87,6 @@ public void Format(int sampleRate, int sampleSize, int channels) { /// public unsafe ReadOnlySpan LoadSamples() { - return new ReadOnlySpan(RaylibApi.LoadWaveSamples(this), (int) (this.FrameCount * this.Channels)); + return new ReadOnlySpan(RaylibApi.LoadWaveSamples(this), (int)(this.FrameCount * this.Channels)); } } \ No newline at end of file diff --git a/src/Raylib-CSharp/Colors/Color.cs b/src/Raylib-CSharp/Colors/Color.cs index 3a7da51..8e81c15 100644 --- a/src/Raylib-CSharp/Colors/Color.cs +++ b/src/Raylib-CSharp/Colors/Color.cs @@ -133,6 +133,11 @@ public static Color AlphaBlend(Color dst, Color src, Color tint) { return RaylibApi.ColorAlphaBlend(dst, src, tint); } + /// + public static Color Lerp(Color color1, Color color2, float factor) { + return RaylibApi.ColorLerp(color1, color2, factor); + } + /// public static Color FromHex(uint hexValue) { return RaylibApi.GetColor(hexValue); diff --git a/src/Raylib-CSharp/Fonts/Font.cs b/src/Raylib-CSharp/Fonts/Font.cs index dadad34..0305cdb 100644 --- a/src/Raylib-CSharp/Fonts/Font.cs +++ b/src/Raylib-CSharp/Fonts/Font.cs @@ -109,9 +109,9 @@ public static unsafe void UnloadData(ReadOnlySpan glyphs) { } } - /// - public bool IsReady() { - return RaylibApi.IsFontReady(this); + /// + public bool IsValid() { + return RaylibApi.IsFontValid(this); } /// diff --git a/src/Raylib-CSharp/Geometry/Mesh.cs b/src/Raylib-CSharp/Geometry/Mesh.cs index ee883b2..d07fa26 100644 --- a/src/Raylib-CSharp/Geometry/Mesh.cs +++ b/src/Raylib-CSharp/Geometry/Mesh.cs @@ -108,6 +108,19 @@ public struct Mesh { /// public unsafe Span BoneWeights => new(this.BoneWeightsPtr, this.VertexCount * 4); + /// + /// Bones animated transformation matrices + /// + public unsafe float* BoneMatricesPtr; + + /// + public unsafe Span BoneMatrices => new(this.BoneMatricesPtr, this.BoneCount); + + /// + /// Number of bones. + /// + public unsafe int BoneCount; + /// /// OpenGL Vertex Array Object id. /// diff --git a/src/Raylib-CSharp/Geometry/Model.cs b/src/Raylib-CSharp/Geometry/Model.cs index 7eaa559..eefd986 100644 --- a/src/Raylib-CSharp/Geometry/Model.cs +++ b/src/Raylib-CSharp/Geometry/Model.cs @@ -123,9 +123,9 @@ public static RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, return RaylibApi.GetRayCollisionQuad(ray, p1, p2, p3, p4); } - /// - public bool IsReady() { - return RaylibApi.IsModelReady(this); + /// + public bool IsValid() { + return RaylibApi.IsModelValid(this); } /// diff --git a/src/Raylib-CSharp/Geometry/ModelAnimation.cs b/src/Raylib-CSharp/Geometry/ModelAnimation.cs index 00534c5..41d0f5e 100644 --- a/src/Raylib-CSharp/Geometry/ModelAnimation.cs +++ b/src/Raylib-CSharp/Geometry/ModelAnimation.cs @@ -72,6 +72,11 @@ public void Update(Model model, int frame) { RaylibApi.UpdateModelAnimation(model, this, frame); } + /// + public void UpdateBones(Model model, int frame) { + RaylibApi.UpdateModelAnimationBones(model, this, frame); + } + /// public bool IsValid(Model model) { return RaylibApi.IsModelAnimationValid(model, this); diff --git a/src/Raylib-CSharp/IO/FileManager.cs b/src/Raylib-CSharp/IO/FileManager.cs index 91f7c73..101774b 100644 --- a/src/Raylib-CSharp/IO/FileManager.cs +++ b/src/Raylib-CSharp/IO/FileManager.cs @@ -1,3 +1,4 @@ +using System.Text; using Raylib_CSharp.Apis; namespace Raylib_CSharp.IO; @@ -6,7 +7,7 @@ public static class FileManager { /// public static unsafe ReadOnlySpan LoadFileData(string fileName) { - return new ReadOnlySpan(RaylibApi.LoadFileData(fileName, out uint dataSize), (int) dataSize); + return new ReadOnlySpan(RaylibApi.LoadFileData(fileName, out uint dataSize), (int)dataSize); } /// @@ -19,14 +20,14 @@ public static unsafe void UnloadFileData(ReadOnlySpan data) { /// public static unsafe bool SaveFileData(string fileName, ReadOnlySpan data) { fixed (byte* dataPtr = data) { - return RaylibApi.SaveFileData(fileName, (nint) dataPtr, (uint) data.Length); + return RaylibApi.SaveFileData(fileName, (nint)dataPtr, (uint)data.Length); } } /// public static unsafe bool ExportDataAsCode(ReadOnlySpan data, string fileName) { fixed (byte* dataPtr = data) { - return RaylibApi.ExportDataAsCode(dataPtr, (uint) data.Length, fileName); + return RaylibApi.ExportDataAsCode(dataPtr, (uint)data.Length, fileName); } } @@ -105,6 +106,11 @@ public static bool ChangeDirectory(string dir) { return RaylibApi.ChangeDirectory(dir); } + /// + public static bool MakeDirectory(string dir) { + return RaylibApi.MakeDirectory(dir); + } + /// public static bool IsPathFile(string path) { return RaylibApi.IsPathFile(path); @@ -177,4 +183,28 @@ public static unsafe ReadOnlySpan DecodeDataBase64(ReadOnlySpan data return new ReadOnlySpan(RaylibApi.DecodeDataBase64(dataPtr, out int outputSize), outputSize); } } + /// + public static unsafe uint ComputeCRC32(ReadOnlySpan data) { + fixed (byte* dataPtr = data) { + return RaylibApi.ComputeCRC32(dataPtr, data.Length); + } + } + /// + public static unsafe uint[] ComputeMD5(ReadOnlySpan data) { + fixed (byte* dataPtr = data) { + uint* nativeResult = RaylibApi.ComputeMD5(dataPtr, data.Length); + uint[] convertedResult = new uint[4]; + for (int ptrIndex = 0; ptrIndex < 4; ptrIndex++) { convertedResult[ptrIndex] = nativeResult[ptrIndex]; } + return convertedResult; + } + } + /// + public static unsafe uint[] ComputeSHA1(ReadOnlySpan data) { + fixed (byte* dataPtr = data) { + uint* nativeResult = RaylibApi.ComputeSHA1(dataPtr, data.Length); + uint[] convertedResult = new uint[5]; + for (int ptrIndex = 0; ptrIndex < 5; ptrIndex++) { convertedResult[ptrIndex] = nativeResult[ptrIndex]; } + return convertedResult; + } + } } \ No newline at end of file diff --git a/src/Raylib-CSharp/Images/Image.cs b/src/Raylib-CSharp/Images/Image.cs index be693de..3d7feae 100644 --- a/src/Raylib-CSharp/Images/Image.cs +++ b/src/Raylib-CSharp/Images/Image.cs @@ -52,8 +52,8 @@ public static Image LoadSvg(string fileNameOrString, int width, int height) { } /// - public static Image LoadAnim(string fileNameOrString, out int frames) { - return RaylibApi.LoadImageAnim(fileNameOrString, out frames); + public static Image LoadAnim(string fileName, out int frames) { + return RaylibApi.LoadImageAnim(fileName, out frames); } /// @@ -159,9 +159,9 @@ public static unsafe void UnloadPalette(ReadOnlySpan colors) { } } - /// - public bool IsReady() { - return RaylibApi.IsImageReady(this); + /// + public bool IsValid() { + return RaylibApi.IsImageValid(this); } /// @@ -397,7 +397,7 @@ public void DrawRectangleV(Vector2 position, Vector2 size, Color color) { } /// - public void DrawRectangleRec(Rectangle rec, Color color) { + public void DrawRectangleRec(Rectangle rec, Color color) { RaylibApi.ImageDrawRectangleRec(ref this, rec, color); } diff --git a/src/Raylib-CSharp/Interact/Input.cs b/src/Raylib-CSharp/Interact/Input.cs index 6b0702f..362f6c9 100644 --- a/src/Raylib-CSharp/Interact/Input.cs +++ b/src/Raylib-CSharp/Interact/Input.cs @@ -126,8 +126,8 @@ public static int SetGamepadMappings(string mappings) { } /// - public static void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor) { - RaylibApi.SetGamepadVibration(gamepad, leftMotor, rightMotor); + public static void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration) { + RaylibApi.SetGamepadVibration(gamepad, leftMotor, rightMotor, duration); } /// diff --git a/src/Raylib-CSharp/Materials/Material.cs b/src/Raylib-CSharp/Materials/Material.cs index 5ca41a6..4f94e26 100644 --- a/src/Raylib-CSharp/Materials/Material.cs +++ b/src/Raylib-CSharp/Materials/Material.cs @@ -46,9 +46,9 @@ public static Material LoadDefault() { return RaylibApi.LoadMaterialDefault(); } - /// - public bool IsReady() { - return RaylibApi.IsMaterialReady(this); + /// + public bool IsValid() { + return RaylibApi.IsMaterialValid(this); } /// @@ -70,7 +70,7 @@ public void SetShader(Shader shader) { /// The index of the material map to modify. /// The texture to assign to the material map. public void SetTexture(MaterialMapIndex mapIndex, Texture2D texture) { - this.Maps[(int) mapIndex].Texture = texture; + this.Maps[(int)mapIndex].Texture = texture; } /// @@ -79,7 +79,7 @@ public void SetTexture(MaterialMapIndex mapIndex, Texture2D texture) { /// The index of the material map. /// The color to set for the material map. public void SetColor(MaterialMapIndex mapIndex, Color color) { - this.Maps[(int) mapIndex].Color = color; + this.Maps[(int)mapIndex].Color = color; } /// @@ -88,6 +88,6 @@ public void SetColor(MaterialMapIndex mapIndex, Color color) { /// The index of the map to modify. /// The new value for the map. public void SetValue(MaterialMapIndex mapIndex, float value) { - this.Maps[(int) mapIndex].Value = value; + this.Maps[(int)mapIndex].Value = value; } } \ No newline at end of file diff --git a/src/Raylib-CSharp/Raylib.cs b/src/Raylib-CSharp/Raylib.cs index bf00dcd..2555584 100644 --- a/src/Raylib-CSharp/Raylib.cs +++ b/src/Raylib-CSharp/Raylib.cs @@ -10,7 +10,7 @@ public static class Raylib { public const string Name = "raylib"; - public static readonly Version Version = new(4, 1, 8); + public static readonly Version Version = new(5, 0, 0); public static readonly Version RlVersion = new(5, 5, 0); /// @@ -52,16 +52,16 @@ public static unsafe void UnloadRandomSequence(ReadOnlySpan sequence) { /// public static unsafe T* MemAlloc(int size) where T : unmanaged { - return (T*) RaylibApi.MemAlloc(size * sizeof(T)); + return (T*)RaylibApi.MemAlloc(size * sizeof(T)); } /// public static unsafe T* MemRealloc(T* ptr, int size) where T : unmanaged { - return (T*) RaylibApi.MemRealloc((nint) ptr, size * sizeof(T)); + return (T*)RaylibApi.MemRealloc((nint)ptr, size * sizeof(T)); } /// public static unsafe void MemFree(T* ptr) where T : unmanaged { - RaylibApi.MemFree((nint) ptr); + RaylibApi.MemFree((nint)ptr); } -} \ No newline at end of file +} diff --git a/src/Raylib-CSharp/Rendering/Graphics.cs b/src/Raylib-CSharp/Rendering/Graphics.cs index 27b8329..9631b90 100644 --- a/src/Raylib-CSharp/Rendering/Graphics.cs +++ b/src/Raylib-CSharp/Rendering/Graphics.cs @@ -273,6 +273,16 @@ public static void DrawModelEx(Model model, Vector3 position, Vector3 rotationAx RaylibApi.DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint); } + /// + public static void DrawModelPoints(Model model, Vector3 position, float scale, Color tint) { + RaylibApi.DrawModelPoints(model, position, scale, tint); + } + + /// + public static void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint) { + RaylibApi.DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint); + } + /// public static void DrawModelWires(Model model, Vector3 position, float scale, Color tint) { RaylibApi.DrawModelWires(model, position, scale, tint); @@ -289,8 +299,8 @@ public static void DrawBoundingBox(BoundingBox box, Color color) { } /// - public static void DrawBillboard(Camera3D camera, Texture2D texture, Vector3 position, float size, Color tint) { - RaylibApi.DrawBillboard(camera, texture, position, size, tint); + public static void DrawBillboard(Camera3D camera, Texture2D texture, Vector3 position, float scale, Color tint) { + RaylibApi.DrawBillboard(camera, texture, position, scale, tint); } /// @@ -358,8 +368,8 @@ public static void DrawCircleSectorLines(Vector2 center, float radius, float sta } /// - public static void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2) { - RaylibApi.DrawCircleGradient(centerX, centerY, radius, color1, color2); + public static void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer) { + RaylibApi.DrawCircleGradient(centerX, centerY, radius, inner, outer); } /// @@ -418,18 +428,18 @@ public static void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotatio } /// - public static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) { - RaylibApi.DrawRectangleGradientV(posX, posY, width, height, color1, color2); + public static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom) { + RaylibApi.DrawRectangleGradientV(posX, posY, width, height, top, bottom); } /// - public static void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2) { - RaylibApi.DrawRectangleGradientH(posX, posY, width, height, color1, color2); + public static void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right) { + RaylibApi.DrawRectangleGradientH(posX, posY, width, height, left, right); } /// - public static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4) { - RaylibApi.DrawRectangleGradientEx(rec, col1, col2, col3, col4); + public static void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight) { + RaylibApi.DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight); } /// @@ -587,4 +597,4 @@ public static void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle public static void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint) { RaylibApi.DrawTextureNPatch(texture, nPatchInfo, dest, origin, rotation, tint); } -} \ No newline at end of file +} diff --git a/src/Raylib-CSharp/Shaders/Shader.cs b/src/Raylib-CSharp/Shaders/Shader.cs index ea29160..6799732 100644 --- a/src/Raylib-CSharp/Shaders/Shader.cs +++ b/src/Raylib-CSharp/Shaders/Shader.cs @@ -31,9 +31,9 @@ public static Shader LoadFromMemory(string vsCode, string fsCode) { return RaylibApi.LoadShaderFromMemory(vsCode, fsCode); } - /// - public bool IsReady() { - return RaylibApi.IsShaderReady(this); + /// + public bool IsValid() { + return RaylibApi.IsShaderValid(this); } /// diff --git a/src/Raylib-CSharp/Textures/CubemapLayout.cs b/src/Raylib-CSharp/Textures/CubemapLayout.cs index 9f130bf..e3f7006 100644 --- a/src/Raylib-CSharp/Textures/CubemapLayout.cs +++ b/src/Raylib-CSharp/Textures/CubemapLayout.cs @@ -25,10 +25,5 @@ public enum CubemapLayout { /// /// Layout is defined by a 4x3 cross with cubemap faces. /// - CrossFourByThree, - - /// - /// Layout is defined by a panorama image (equirrectangular map). - /// - Panorama + CrossFourByThree } \ No newline at end of file diff --git a/src/Raylib-CSharp/Textures/RenderTexture2D.cs b/src/Raylib-CSharp/Textures/RenderTexture2D.cs index ef20752..b2d2e20 100644 --- a/src/Raylib-CSharp/Textures/RenderTexture2D.cs +++ b/src/Raylib-CSharp/Textures/RenderTexture2D.cs @@ -26,9 +26,9 @@ public static RenderTexture2D Load(int width, int height) { return RaylibApi.LoadRenderTexture(width, height); } - /// - public bool IsReady() { - return RaylibApi.IsRenderTextureReady(this); + /// + public bool IsValid() { + return RaylibApi.IsRenderTextureValid(this); } /// diff --git a/src/Raylib-CSharp/Textures/Texture2D.cs b/src/Raylib-CSharp/Textures/Texture2D.cs index 7ccd3bc..c07145a 100644 --- a/src/Raylib-CSharp/Textures/Texture2D.cs +++ b/src/Raylib-CSharp/Textures/Texture2D.cs @@ -48,9 +48,9 @@ public static Texture2D LoadCubemap(Image image, CubemapLayout layout) { return RaylibApi.LoadTextureCubemap(image, layout); } - /// - public bool IsReady() { - return RaylibApi.IsTextureReady(this); + /// + public bool IsValid() { + return RaylibApi.IsTextureValid(this); } /// diff --git a/src/Raylib-CSharp/Windowing/Window.cs b/src/Raylib-CSharp/Windowing/Window.cs index 3beec33..5576c36 100644 --- a/src/Raylib-CSharp/Windowing/Window.cs +++ b/src/Raylib-CSharp/Windowing/Window.cs @@ -238,6 +238,11 @@ public static string GetClipboardText() { return RaylibApi.GetClipboardText(); } + /// + public static Image GetClipboardImage() { + return RaylibApi.GetClipboardImage(); + } + /// public static void EnableEventWaiting() { RaylibApi.EnableEventWaiting();