From 2268c115e08252f4fee033e3f4e93c4fa4da81b9 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Sat, 23 Oct 2021 20:38:11 +0100 Subject: [PATCH] Update Raylib.cs functions 1 --- Raylib-cs.Tests/RaylibTests.cs | 4 +- Raylib-cs/Raylib.cs | 241 +++++++++++++++++++++------------ 2 files changed, 154 insertions(+), 91 deletions(-) diff --git a/Raylib-cs.Tests/RaylibTests.cs b/Raylib-cs.Tests/RaylibTests.cs index 2203cea..e3b6ce5 100644 --- a/Raylib-cs.Tests/RaylibTests.cs +++ b/Raylib-cs.Tests/RaylibTests.cs @@ -15,7 +15,7 @@ namespace Raylib_cs.Tests Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); - Assert.True(BlittableHelper.IsBlittable()); + Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); @@ -29,7 +29,7 @@ namespace Raylib_cs.Tests Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); - Assert.True(BlittableHelper.IsBlittable()); + Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); Assert.True(BlittableHelper.IsBlittable()); diff --git a/Raylib-cs/Raylib.cs b/Raylib-cs/Raylib.cs index 50eb22f..3bf3b6f 100644 --- a/Raylib-cs/Raylib.cs +++ b/Raylib-cs/Raylib.cs @@ -215,10 +215,10 @@ namespace Raylib_cs } /// - /// Font character info + /// GlyphInfo, font characters glyphs info /// [StructLayout(LayoutKind.Sequential)] - public struct CharInfo + public struct GlyphInfo { /// /// Character value (Unicode) @@ -652,7 +652,7 @@ namespace Raylib_cs /// Raycast hit information [StructLayout(LayoutKind.Sequential)] - public struct RayHitInfo + public struct RayCollision { /// /// Did the ray hit something? @@ -2010,6 +2010,22 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SetClipboardText([MarshalAs(UnmanagedType.LPUTF8Str)] string text); + // Custom frame control functions + // NOTE: Those functions are intended for advance users that want full control over the frame processing + // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents() + // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL + + /// Swap back buffer with front buffer (screen drawing) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void SwapScreenBuffer(); + + /// Register all input events + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void PollInputEvents(); + + /// Wait for some milliseconds (halt program execution) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void WaitTime(float ms); // Cursor-related functions @@ -2229,6 +2245,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int GetRandomValue(int min, int max); + /// Set the seed for the random number generator + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int SetRandomSeed(uint seed); + /// Takes a screenshot of current screen (saved a .png) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void TakeScreenshot(string fileName); @@ -2391,11 +2411,6 @@ namespace Raylib_cs [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsGamepadAvailable(int gamepad); - /// Check gamepad name (if available) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool IsGamepadName(int gamepad, string name); - /// Return gamepad internal name id [DllImport(nativeLibName, EntryPoint = "GetGamepadName", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr INTERNAL_GetGamepadName(int gamepad); @@ -2477,6 +2492,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Vector2 GetMousePosition(); + /// Get mouse delta between frames + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Vector2 GetMouseDelta(); + /// Set mouse position XY [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SetMousePosition(int x, int y); @@ -2512,6 +2531,14 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Vector2 GetTouchPosition(int index); + /// Get touch point identifier for given index + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int GetTouchPointId(int index); + + /// Get number of touch points + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern int GetTouchPointCount(); + //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ @@ -2621,6 +2648,11 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thick, Color color); + /// Draw line using cubic bezier curves with 2 control points + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thick, Color color); + + /// Draw lines sequence [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawLineStrip(Vector2[] points, int numPoints, Color color); @@ -2733,6 +2765,9 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); + /// Draw a polygon outline of n sides with extended parameters + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Basic shapes collision detection functions @@ -2771,6 +2806,10 @@ namespace Raylib_cs [return: MarshalAs(UnmanagedType.I1)] public static extern bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint); + /// Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); + /// Get collision rectangle for two rectangles collision [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); @@ -2800,6 +2839,14 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Image LoadImageFromMemory(string fileType, IntPtr fileData, int dataSize); + /// Load image from GPU texture data + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Image LoadImageFromTexture(Texture2D texture); + + /// Load image from screen buffer and (screenshot) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Image LoadImageFromScreen(); + /// Unload image from CPU memory (RAM) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadImage(Image image); @@ -2839,10 +2886,6 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Image GenImageWhiteNoise(int width, int height, float factor); - /// Generate image: perlin noise - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); - /// Generate image: cellular algorithm. Bigger tileSize means bigger cells [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Image GenImageCellular(int width, int height, int tileSize); @@ -2978,6 +3021,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Rectangle GetImageAlphaBorder(Image image, float threshold); + /// Get image pixel color at (x, y) position + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Color GetImageColor(Image image, int x, int y); + // Image drawing functions // NOTE: Image software-rendering functions (CPU) @@ -3076,14 +3123,6 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UpdateTextureRec(Texture2D texture, Rectangle rec, IntPtr pixels); - /// Get pixel data from GPU texture and return an Image - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Image GetTextureData(Texture2D texture); - - /// Get pixel data from screen buffer and return an Image (screenshot) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern Image GetScreenData(); - // Texture configuration functions @@ -3215,7 +3254,7 @@ namespace Raylib_cs /// Load font data for further use /// fileData refers to const unsigned char * - /// IntPtr refers to CharInfo * + /// IntPtr refers to GlyphInfo * [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr LoadFontData(IntPtr fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type); @@ -3224,7 +3263,7 @@ namespace Raylib_cs public static extern Image GenImageFontAtlas(IntPtr chars, ref IntPtr recs, int charsCount, int fontSize, int padding, int packMethod); /// Unload font chars info data (RAM) - /// chars refers to CharInfo * + /// chars refers to GlpyhInfo * [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadFontData(IntPtr chars, int charsCount); @@ -3247,13 +3286,9 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawTextEx(Font font, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, Vector2 position, float fontSize, float spacing, Color tint); - /// Draw text using font inside rectangle limits + /// Draw text using Font and pro parameters (rotation) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawTextRec(Font font, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); - - /// Draw text using font inside rectangle limits with support for text selection - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void DrawTextRecEx(Font font, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectText, Color selectBack); + public static extern void DrawTextPro(Font font, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, Vector2 position, float fontSize, float spacing, Color tint); /// Draw one character (codepoint) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -3270,10 +3305,18 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Vector2 MeasureTextEx(Font font, [MarshalAs(UnmanagedType.LPUTF8Str)] string text, float fontSize, float spacing); - /// Get index position for a unicode character on font + /// Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int GetGlyphIndex(Font font, int character); + /// Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern GlyphInfo GetGlyphInfo(Font font, int codepoint); + + /// Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Rectangle GetGlyphAtlasRec(Font font, int codepoint); + // Text strings management functions // NOTE: Some strings allocate memory internally for returned strings, just be careful! @@ -3368,6 +3411,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color); + /// Draw cube with a region of a texture + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawCubeTextureRec(Texture2D texture, Vector3 position, float width, float height, float length, Color color); + /// Draw sphere [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawSphere(Vector3 centerPos, float radius, Color color); @@ -3384,10 +3431,18 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); + /// Draw a cylinder with base at startPos and top at endPos + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); + /// Draw a cylinder/cone wires [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); + /// Draw a cylinder wires with base at startPos and top at endPos + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); + /// Draw a plane XZ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawPlane(Vector3 centerPos, Vector2 size, Color color); @@ -3423,6 +3478,9 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UnloadModelKeepMeshes(Model model); + /// Compute model bounding box limits (considers all meshes) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern BoundingBox GetModelBoundingBox(Model model); // Mesh loading/unloading functions @@ -3435,6 +3493,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UpdateMeshBuffer(Mesh mesh, int index, IntPtr data, int dataSize, int offset); + /// Unload mesh from memory (RAM and/or VRAM) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void UnloadMesh(ref Mesh mesh); + /// Draw a 3d mesh with material and transform [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawMesh(Mesh mesh, Material material, Matrix4x4 transform); @@ -3443,15 +3505,23 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawMeshInstanced(Mesh mesh, Material material, Matrix4x4[] transforms, int instances); - /// Unload mesh from memory (RAM and/or VRAM) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void UnloadMesh(ref Mesh mesh); - /// Export mesh data to file, returns true on success [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool ExportMesh(Mesh mesh, string fileName); + /// Compute mesh bounding box limits + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern BoundingBox GetMeshBoundingBox(Mesh mesh); + + /// Compute mesh tangents + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void GenMeshTangents(ref Mesh mesh); + + /// Compute mesh binormals + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void GenMeshBinormals(ref Mesh mesh); + // Material loading/unloading functions @@ -3477,31 +3547,6 @@ namespace Raylib_cs public static extern void SetModelMeshMaterial(ref Model model, int meshId, int materialId); - // Model animations loading/unloading functions - - /// Load model animations from file - /// IntPtr refers to ModelAnimation * - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr LoadModelAnimations(string fileName, ref int animsCount); - - /// Update model animation pose - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); - - /// Unload animation data - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void UnloadModelAnimation(ModelAnimation anim); - - /// Unload animation array data - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void UnloadModelAnimations(ModelAnimation[] animations, int count); - - /// Check model animation skeleton match - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool IsModelAnimationValid(Model model, ModelAnimation anim); - - // Mesh generation functions /// Generate polygonal mesh @@ -3528,6 +3573,10 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Mesh GenMeshCylinder(float radius, float height, int slices); + /// Generate cone/pyramid mesh + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Mesh GenMeshCone(float radius, float height, int slices); + /// Generate torus mesh [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); @@ -3544,22 +3593,6 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); - - // Mesh manipulation functions - - /// Compute mesh bounding box limits - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern BoundingBox MeshBoundingBox(Mesh mesh); - - /// Compute mesh tangents - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void MeshTangents(ref Mesh mesh); - - /// Compute mesh binormals - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void MeshBinormals(ref Mesh mesh); - - // Model drawing functions /// Draw a model (with texture if set) @@ -3590,6 +3623,33 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); + // Draw a billboard texture defined by source and rotation + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void DrawBillboardPro(Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); + + // Model animations loading/unloading functions + + /// Load model animations from file + /// IntPtr refers to ModelAnimation * + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr LoadModelAnimations(string fileName, ref int animsCount); + + /// Update model animation pose + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); + + /// Unload animation data + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void UnloadModelAnimation(ModelAnimation anim); + + /// Unload animation array data + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void UnloadModelAnimations(ModelAnimation[] animations, int count); + + /// Check model animation skeleton match + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool IsModelAnimationValid(Model model, ModelAnimation anim); // Collision detection functions @@ -3611,29 +3671,28 @@ namespace Raylib_cs /// Detect collision between ray and sphere [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] - public static extern bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); - - /// Detect collision between ray and sphere, returns collision point - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, ref Vector3 collisionPoint); + public static extern bool GetRayCollisionSphere(Ray ray, Vector3 center, float radius); /// Detect collision between ray and box [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] - public static extern bool CheckCollisionRayBox(Ray ray, BoundingBox box); + public static extern RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); /// Get collision info between ray and model [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern RayHitInfo GetCollisionRayModel(Ray ray, Model model); + public static extern RayCollision GetRayCollisionModel(Ray ray, Model model); + + /// Get collision info between ray and model + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix4x4 transform); /// Get collision info between ray and triangle [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); + public static extern RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); - /// Get collision info between ray and ground plane (Y-normal plane) + /// Get collision info between ray and quad [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); + public static extern RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); //------------------------------------------------------------------------------------ @@ -3784,6 +3843,11 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void PlayMusicStream(Music music); + /// Check if music is playing + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool IsMusicStreamPlaying(Music music); + /// Updates buffers for music streaming [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void UpdateMusicStream(Music music); @@ -3800,10 +3864,9 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void ResumeMusicStream(Music music); - /// Check if music is playing + /// Seek music to a position (in seconds) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool IsMusicPlaying(Music music); + public static extern void SeekMusicStream(Music music, float position); /// Set volume for music (1.0 is max level) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] @@ -3826,7 +3889,7 @@ namespace Raylib_cs /// Init audio stream (to stream raw audio pcm data) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern AudioStream InitAudioStream(uint sampleRate, uint sampleSize, uint channels); + public static extern AudioStream LoadAudioStream(uint sampleRate, uint sampleSize, uint channels); /// Update audio stream buffers with data /// data refers to a const void *