diff --git a/Raylib-cs/Raylib-cs.csproj b/Raylib-cs/Raylib-cs.csproj
index 1930488..fa8a6cd 100644
--- a/Raylib-cs/Raylib-cs.csproj
+++ b/Raylib-cs/Raylib-cs.csproj
@@ -49,5 +49,6 @@
+
diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs
index eeaec0d..a4a3cc4 100644
--- a/Raylib-cs/interop/Raylib.cs
+++ b/Raylib-cs/interop/Raylib.cs
@@ -122,6 +122,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowSize(int width, int height);
+ /// Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetWindowOpacity(float opacity);
+
/// Get native window handle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* GetWindowHandle();
@@ -134,6 +138,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetScreenHeight();
+ /// Get current render width (it considers HiDPI)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int GetRenderWidth();
+
+ /// Get current render height (it considers HiDPI)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int GetRenderHeight();
+
/// Get number of connected monitors
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetMonitorCount();
@@ -186,6 +198,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetClipboardText(sbyte* text);
+ /// Enable waiting for events on EndDrawing(), no automatic event polling
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void EnableEventWaiting();
+
+ /// Disable waiting for events on EndDrawing(), automatic events polling
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DisableEventWaiting();
+
// 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()
@@ -199,9 +219,9 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void PollInputEvents();
- /// Wait for some milliseconds (halt program execution)
+ /// Wait for some time (halt program execution)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void WaitTime(float ms);
+ public static extern void WaitTime(double seconds);
// Cursor-related functions
@@ -478,6 +498,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool SaveFileData(sbyte* fileName, void* data, uint bytesToWrite);
+ /// Export data to code (.h), returns true on success
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool ExportDataAsCode(sbyte* data, uint size, sbyte* fileName);
+
// Load text data from file (read), returns a '\0' terminated string
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* LoadFileText(sbyte* fileName);
@@ -502,6 +526,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext);
+ /// Get file length in bytes
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int GetFileLength(sbyte* fileName);
+
/// Get pointer to extension for a filename string (includes dot: '.png')
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* GetFileExtension(sbyte* fileName);
@@ -526,13 +554,21 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* GetWorkingDirectory();
+ /// Get the directory if the running application (uses static string)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern sbyte* GetApplicationDirectory();
+
/// Get filenames in a directory path (memory should be freed)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern char** GetDirectoryFiles(sbyte* dirPath, int* count);
+ public static extern FilePathList LoadDirectoryFiles(sbyte* dirPath, int* count);
/// Clear directory files paths buffers (free memory)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ClearDirectoryFiles();
+ public static extern void UnloadDirectoryFiles(FilePathList files);
+
+ /// Check if a given path is a file or a directory
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsPathFile(sbyte* path);
/// Change working directory, return true on success
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -544,11 +580,11 @@ namespace Raylib_cs
/// Get dropped files names (memory should be freed)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern sbyte** GetDroppedFiles(int* count);
+ public static extern FilePathList LoadDroppedFiles();
/// Clear dropped files paths buffer (free memory)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ClearDroppedFiles();
+ public static extern void UnloadDroppedFiles(FilePathList files);
/// Get file modification time (last write time)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -712,10 +748,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMouseScale(float scaleX, float scaleY);
- /// Returns mouse wheel movement Y
+ /// Get mouse wheel movement for X or Y, whichever is larger
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetMouseWheelMove();
+ /// Get mouse wheel movement for both X and Y
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Vector2 GetMouseWheelMoveV();
+
/// Set mouse cursor
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMouseCursor(MouseCursor cursor);
@@ -1049,11 +1089,11 @@ namespace Raylib_cs
/// Export image data to file
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ExportImage(Image image, sbyte* fileName);
+ public static extern CBool ExportImage(Image image, sbyte* fileName);
/// Export image as code file defining an array of bytes
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ExportImageAsCode(Image image, sbyte* fileName);
+ public static extern CBool ExportImageAsCode(Image image, sbyte* fileName);
// Image generation functions
@@ -1082,7 +1122,7 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image GenImageWhiteNoise(int width, int height, float factor);
- /// Generate image: cellular algorithm. Bigger tileSize means bigger cells
+ /// 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);
@@ -1370,31 +1410,31 @@ namespace Raylib_cs
// Color/pixel related functions
- /// Returns hexadecimal value for a Color
+ /// Get hexadecimal value for a Color
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ColorToInt(Color color);
- /// Returns color normalized as float [0..1]
+ /// Get color normalized as float [0..1]
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector4 ColorNormalize(Color color);
- /// Returns color from normalized values [0..1]
+ /// Get color from normalized values [0..1]
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorFromNormalized(Vector4 normalized);
- /// Returns HSV values for a Color, hue [0..360], saturation/value [0..1]
+ /// Get HSV values for a Color, hue [0..360], saturation/value [0..1]
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 ColorToHSV(Color color);
- /// Returns a Color from HSV values, hue [0..360], saturation/value [0..1]
+ /// Get a Color from HSV values, hue [0..360], saturation/value [0..1]
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorFromHSV(float hue, float saturation, float value);
- /// Returns color with alpha applied, alpha goes from 0.0f to 1.0f
+ /// Get color with alpha applied, alpha goes from 0.0f to 1.0f
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorAlpha(Color color, float alpha);
- /// Returns src alpha-blended into dst color with tint
+ /// Get src alpha-blended into dst color with tint
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorAlphaBlend(Color dst, Color src, Color tint);
@@ -1429,7 +1469,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Font LoadFont(sbyte* fileName);
- /// Load font from file with extended parameters
+ ///
+ /// Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load
+ /// the default character set
+ ///
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Font LoadFontEx(sbyte* fileName, int fontSize, int* fontChars, int glyphCount);
@@ -1458,6 +1501,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadFont(Font font);
+ /// Export font as code file, returns true on success
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool ExportFontAsCode(Font font, sbyte* fileName);
+
// Text drawing functions
@@ -1479,8 +1526,11 @@ namespace Raylib_cs
/// Draw one character (codepoint)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint);
+ public static extern void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint);
+ /// Draw multiple characters (codepoint)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawTextCodepoints(Font font, int* codepoints, int count, Vector2 position, float fontSize, float spacing, Color tint);
// Text font info functions
@@ -1850,7 +1900,7 @@ namespace Raylib_cs
/// Draw a billboard texture defined by source
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle source, Vector3 center, float size, Color tint);
+ public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint);
/// Draw a billboard texture defined by source and rotation
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1894,16 +1944,12 @@ namespace Raylib_cs
/// Detect collision between ray and sphere
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool GetRayCollisionSphere(Ray ray, Vector3 center, float radius);
+ public static extern RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius);
/// Detect collision between ray and box
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern RayCollision GetRayCollisionBox(Ray ray, BoundingBox box);
- /// Get collision info between ray and model
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern RayCollision GetRayCollisionModel(Ray ray, Model model);
-
/// Get collision info between ray and mesh
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix4x4 transform);
@@ -1973,11 +2019,11 @@ namespace Raylib_cs
/// Export wave data to file
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ExportWave(Wave wave, sbyte* fileName);
+ public static extern CBool ExportWave(Wave wave, sbyte* fileName);
/// Export wave sample data to code (.h)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ExportWaveAsCode(Wave wave, sbyte* fileName);
+ public static extern CBool ExportWaveAsCode(Wave wave, sbyte* fileName);
// Wave/Sound management functions
@@ -2022,9 +2068,9 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetSoundPitch(Sound sound, float pitch);
- /// Convert wave data to desired format
+ /// Set pan for a sound (0.5 is center)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void WaveFormat(Wave* wave, int sampleRate, int sampleSize, int channels);
+ public static extern void SetSoundPan(Sound sound, float pan);
/// Copy a wave to a new wave
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2034,6 +2080,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void WaveCrop(Wave* wave, int initSample, int finalSample);
+ /// Convert wave data to desired format
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void WaveFormat(Wave* wave, int sampleRate, int sampleSize, int channels);
+
//TODO: Span
/// Get samples data from wave as a floats array
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2095,6 +2145,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMusicPitch(Music music, float pitch);
+ /// Set pan for a music (0.5 is center)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetMusicPan(Music music, float pan);
+
/// Get music time length (in seconds)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetMusicTimeLength(Music music);
@@ -2150,8 +2204,22 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetAudioStreamPitch(AudioStream stream, float pitch);
+ /// Set pan for audio stream (0.5 is centered)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetAudioStreamPan(AudioStream stream, float pan);
+
/// Default size for new audio streams
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetAudioStreamBufferSizeDefault(int size);
+
+ // Audio thread callback to request new data
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetAudioStreamCallback(AudioStream stream, delegate* unmanaged[Cdecl] callback);
+
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void AttachAudioStreamProcessor(AudioStream stream, delegate* unmanaged[Cdecl] processor);
+
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DetachAudioStreamProcessor(AudioStream stream, delegate* unmanaged[Cdecl] processor);
}
}
diff --git a/Raylib-cs/interop/Raymath.cs b/Raylib-cs/interop/Raymath.cs
index 99a49c7..2fdb234 100644
--- a/Raylib-cs/interop/Raymath.cs
+++ b/Raylib-cs/interop/Raymath.cs
@@ -76,9 +76,9 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
- /// Calculate distance between two vectors
+ /// Calculate square distance between two vectors
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
+ public static extern float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
/// Calculate angle from two vectors in X-axis
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -104,6 +104,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Normalize(Vector2 v);
+ /// Transforms a Vector2 by a given Matrix
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Vector2 Vector2Transform(Vector2 v, Matrix4x4 mat);
+
/// Calculate linear interpolation between two vectors
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
@@ -169,6 +173,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
+ /// Calculate square distance between two vectors
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern float Vector3DistanceSqr(Vector3 v1, Vector3 v2);
+
/// Calculate angle between two vectors in XY and XZ
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector3Angle(Vector3 v1, Vector3 v2);
diff --git a/Raylib-cs/interop/Rlgl.cs b/Raylib-cs/interop/Rlgl.cs
index cdf0d5d..8e49be1 100644
--- a/Raylib-cs/interop/Rlgl.cs
+++ b/Raylib-cs/interop/Rlgl.cs
@@ -511,7 +511,7 @@ namespace Raylib_cs
/// Update GPU texture with new data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, void* data);
+ public static extern void rlUpdateTexture(uint id, int offsetX, int offsetY, int width, int height, PixelFormat format, void* data);
/// Get OpenGL internal formats
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -659,7 +659,7 @@ namespace Raylib_cs
/// Get internal accumulated transform matrix
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Matrix4x4 rlGetMatrixTramsform();
+ public static extern Matrix4x4 rlGetMatrixTransform();
/// Get internal projection matrix for stereo render (selected eye)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
diff --git a/Raylib-cs/types/Core.cs b/Raylib-cs/types/Core.cs
index 63d4a43..40042c2 100644
--- a/Raylib-cs/types/Core.cs
+++ b/Raylib-cs/types/Core.cs
@@ -70,6 +70,11 @@ namespace Raylib_cs
///
FLAG_WINDOW_HIGHDPI = 0x00002000,
+ ///
+ /// Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
+ ///
+ FLAG_WINDOW_MOUSE_PASSTHROUGH = 0x00004000,
+
///
/// Set to try enabling MSAA 4X
///
@@ -158,6 +163,11 @@ namespace Raylib_cs
///
BLEND_SUBTRACT_COLORS,
+ ///
+ /// Blend premultiplied textures considering alpha
+ ///
+ BLEND_ALPHA_PREMULTIPLY,
+
///
/// Blend textures using custom src/dst factors (use rlSetBlendMode())
///
diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs
index 4d6ab6d..737c6b3 100644
--- a/Raylib-cs/types/Raylib.Utils.cs
+++ b/Raylib-cs/types/Raylib.Utils.cs
@@ -190,14 +190,14 @@ namespace Raylib_cs
/// Get dropped files names (memory should be freed)
public static string[] GetDroppedFiles()
{
- int count;
- var buffer = GetDroppedFiles(&count);
- var files = new string[count];
+ var filePathList = LoadDroppedFiles();
+ var files = new string[filePathList.count];
- for (var i = 0; i < count; i++)
+ for (var i = 0; i < filePathList.count; i++)
{
- files[i] = Marshal.PtrToStringUTF8((IntPtr)buffer[i]);
+ files[i] = Marshal.PtrToStringUTF8((IntPtr)filePathList.paths[i]);
}
+ UnloadDroppedFiles(filePathList);
return files;
}
diff --git a/Raylib-cs/types/native/CBool.cs b/Raylib-cs/types/native/CBool.cs
index d3a8e5f..376d581 100644
--- a/Raylib-cs/types/native/CBool.cs
+++ b/Raylib-cs/types/native/CBool.cs
@@ -67,7 +67,7 @@ namespace Raylib_cs
{
return new CBool { value = (sbyte)(left.value - right.value) };
}
-
+
// ToString override
public override string ToString()
{
diff --git a/Raylib-cs/types/native/FilePathList.cs b/Raylib-cs/types/native/FilePathList.cs
new file mode 100644
index 0000000..a2e33e2
--- /dev/null
+++ b/Raylib-cs/types/native/FilePathList.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Raylib_cs
+{
+ ///
+ /// File path list
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ public unsafe struct FilePathList
+ {
+ ///
+ /// Filepaths max entries
+ ///
+ public uint capacity;
+
+ ///
+ /// Filepaths entries count
+ ///
+ public uint count;
+
+ ///
+ /// Filepaths entries
+ ///
+ public byte** paths;
+ }
+}