diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs
index f36f559..019a703 100644
--- a/Raylib-cs/interop/Raylib.cs
+++ b/Raylib-cs/interop/Raylib.cs
@@ -13,7 +13,7 @@ namespace Raylib_cs
///
public const string nativeLibName = "raylib";
- public const string RAYLIB_VERSION = "4.2";
+ public const string RAYLIB_VERSION = "4.5";
public const float DEG2RAD = MathF.PI / 180.0f;
public const float RAD2DEG = 180.0f / MathF.PI;
@@ -98,10 +98,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void RestoreWindow();
- /// Set icon for window (only PLATFORM_DESKTOP)
+ /// Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowIcon(Image image);
+ /// Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetWindowIcons(Image* images, int count);
+
/// Set title for window (only PLATFORM_DESKTOP)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowTitle(sbyte* title);
@@ -342,6 +346,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Shader LoadShaderFromMemory(sbyte* vsCode, sbyte* fsCode);
+ /// Check if a shader is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsShaderReady(Shader shader);
+
/// Get shader uniform location
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetShaderLocation(Shader shader, sbyte* uniformName);
@@ -352,19 +360,30 @@ namespace Raylib_cs
/// Set shader uniform value
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetShaderValue(Shader shader, int uniformLoc, void* value, ShaderUniformDataType uniformType);
+ public static extern void SetShaderValue(
+ Shader shader,
+ int locIndex,
+ void* value,
+ ShaderUniformDataType uniformType
+ );
/// Set shader uniform value vector
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetShaderValueV(Shader shader, int uniformLoc, void* value, ShaderUniformDataType uniformType, int count);
+ public static extern void SetShaderValueV(
+ Shader shader,
+ int locIndex,
+ void* value,
+ ShaderUniformDataType uniformType,
+ int count
+ );
/// Set shader uniform value (matrix 4x4)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix4x4 mat);
+ public static extern void SetShaderValueMatrix(Shader shader, int locIndex, Matrix4x4 mat);
- /// Set shader uniform value for texture
+ /// Set shader uniform value for texture (sampler2d)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture);
+ public static extern void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture);
/// Unload shader from GPU memory (VRAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -473,7 +492,9 @@ namespace Raylib_cs
/// Set custom file binary data saver
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetSaveFileDataCallback(delegate* unmanaged[Cdecl] callback);
+ public static extern void SetSaveFileDataCallback(
+ delegate* unmanaged[Cdecl] callback
+ );
/// Set custom file text data loader
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -494,13 +515,13 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadFileData(byte* data);
- /// Save data to file from byte array (write)
+ /// Save data to file from byte array (write), returns true on success
[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);
+ public static extern CBool ExportDataAsCode(byte* data, uint size, sbyte* fileName);
// Load text data from file (read), returns a '\0' terminated string
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -522,11 +543,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool DirectoryExists(sbyte* dirPath);
- /// Check file extension
+ /// Check file extension (including point: .png, .wav)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext);
- /// Get file length in bytes
+ /// Get file length in bytes
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetFileLength(sbyte* fileName);
@@ -558,11 +579,15 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* GetApplicationDirectory();
- /// Get filenames in a directory path (memory should be freed)
+ /// Load directory filepaths
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern FilePathList LoadDirectoryFiles(sbyte* dirPath, int* count);
- /// Clear directory files paths buffers (free memory)
+ /// Load directory filepaths with extension filtering and recursive directory scan
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern FilePathList LoadDirectoryFilesEx(sbyte* basePath, sbyte* filter, CBool scanSubdirs);
+
+ /// Unload filepaths
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadDirectoryFiles(FilePathList files);
@@ -578,11 +603,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsFileDropped();
- /// Get dropped files names (memory should be freed)
+ /// Load dropped filepaths
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern FilePathList LoadDroppedFiles();
- /// Clear dropped files paths buffer (free memory)
+ /// Unload dropped filepaths
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadDroppedFiles(FilePathList files);
@@ -593,21 +618,21 @@ namespace Raylib_cs
// Compression/Encoding functionality
- /// Compress data (DEFLATE algorithm)
+ /// Compress data (DEFLATE algorithm), memory must be MemFree()
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern byte* CompressData(byte* data, int dataLength, int* compDataLength);
+ public static extern byte* CompressData(byte* data, int dataSize, int* compDataSize);
- /// Decompress data (DEFLATE algorithm)
+ /// Decompress data (DEFLATE algorithm), memory must be MemFree()
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern byte* DecompressData(byte* compData, int compDataLength, int* dataLength);
+ public static extern byte* DecompressData(byte* compData, int compDataSize, int* dataSize);
- /// Encode data to Base64 string
+ /// Encode data to Base64 string, memory must be MemFree()
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern sbyte* EncodeDataBase64(byte* data, int dataLength, int* outputLength);
+ public static extern sbyte* EncodeDataBase64(byte* data, int dataSize, int* outputSize);
- /// Decode Base64 string data
+ /// Decode Base64 string data, memory must be MemFree()
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern byte* DecodeDataBase64(byte* data, int* outputLength);
+ public static extern byte* DecodeDataBase64(byte* data, int* outputSize);
/// Open URL with default system browser (if available)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -639,11 +664,15 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetExitKey(KeyboardKey key);
- /// Get key pressed (keycode), call it multiple times for keys queued
+ ///
+ /// Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
+ ///
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetKeyPressed();
- /// Get char pressed (unicode), call it multiple times for chars queued
+ ///
+ /// Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
+ ///
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetCharPressed();
@@ -780,19 +809,14 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetGesturesEnabled(Gesture flags);
- /// Check if a gesture have been detected
+ /// Check if a gesture has been detected
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsGestureDetected(Gesture gesture);
-
/// Get latest detected gesture
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Gesture GetGestureDetected();
- /// Get touch points count
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetTouchPointsCount();
-
/// Get gesture hold time in milliseconds
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetGestureHoldDuration();
@@ -823,23 +847,11 @@ namespace Raylib_cs
/// Update camera position for selected mode
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void UpdateCamera(Camera3D* camera);
+ public static extern void UpdateCamera(Camera3D* camera, CameraMode mode);
- /// Set camera pan key to combine with mouse movement (free camera)
+ /// Update camera movement/rotation
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetCameraPanControl(KeyboardKey panKey);
-
- /// Set camera alt key to combine with mouse movement (free camera)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetCameraAltControl(KeyboardKey altKey);
-
- /// Set camera smooth zoom key to combine with mouse (free camera)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetCameraSmoothZoomControl(KeyboardKey szKey);
-
- /// Set camera move controls (1st person and 3rd person cameras)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetCameraMoveControls(KeyboardKey frontKey, KeyboardKey backKey, KeyboardKey rightKey, KeyboardKey leftKey, KeyboardKey upKey, KeyboardKey downKey);
+ public static extern void UpdateCameraPro(Camera3D* camera, Vector3 movement, Vector3 rotation, float zoom);
//------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes)
@@ -881,16 +893,28 @@ namespace Raylib_cs
/// Draw line using quadratic bezier curves with a control point
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thick, Color color);
+ 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);
-
+ 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);
+ public static extern void DrawLineStrip(Vector2* points, int pointCount, Color color);
/// Draw a color-filled circle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -898,15 +922,35 @@ namespace Raylib_cs
/// Draw a piece of a circle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color);
+ public static extern void DrawCircleSector(
+ Vector2 center,
+ float radius,
+ float startAngle,
+ float endAngle,
+ int segments,
+ Color color
+ );
/// Draw circle sector outline
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color);
+ public static extern void DrawCircleSectorLines(
+ Vector2 center,
+ float radius,
+ float startAngle,
+ float endAngle,
+ int segments,
+ Color color
+ );
/// Draw a gradient-filled circle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);
+ public static extern void DrawCircleGradient(
+ int centerX,
+ int centerY,
+ float radius,
+ Color color1,
+ Color color2
+ );
/// Draw a color-filled circle (Vector version)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -926,11 +970,27 @@ namespace Raylib_cs
/// Draw ring
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color);
+ public static extern void DrawRing(
+ Vector2 center,
+ float innerRadius,
+ float outerRadius,
+ float startAngle,
+ float endAngle,
+ int segments,
+ Color color
+ );
/// Draw ring outline
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color);
+ public static extern void DrawRingLines(
+ Vector2 center,
+ float innerRadius,
+ float outerRadius,
+ float startAngle,
+ float endAngle,
+ int segments,
+ Color color
+ );
/// Draw a color-filled rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -950,15 +1010,35 @@ namespace Raylib_cs
/// Draw a vertical-gradient-filled rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);
+ public static extern void DrawRectangleGradientV(
+ int posX,
+ int posY,
+ int width,
+ int height,
+ Color color1,
+ Color color2
+ );
/// Draw a horizontal-gradient-filled rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);
+ public static extern void DrawRectangleGradientH(
+ int posX,
+ int posY,
+ int width,
+ int height,
+ Color color1,
+ Color color2
+ );
/// Draw a gradient-filled rectangle with custom vertex colors
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4);
+ public static extern void DrawRectangleGradientEx(
+ Rectangle rec,
+ Color col1,
+ Color col2,
+ Color col3,
+ Color col4
+ );
/// Draw rectangle outline
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -974,7 +1054,13 @@ namespace Raylib_cs
/// Draw rectangle with rounded edges outline
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color);
+ public static extern void DrawRectangleRoundedLines(
+ Rectangle rec,
+ float roundness,
+ int segments,
+ float lineThick,
+ Color color
+ );
/// Draw a color-filled triangle (vertex in counter-clockwise order!)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -986,11 +1072,11 @@ namespace Raylib_cs
/// Draw a triangle fan defined by points (first vertex is the center)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTriangleFan(Vector2* points, int numPoints, Color color);
+ public static extern void DrawTriangleFan(Vector2* points, int pointCount, Color color);
/// Draw a triangle strip defined by points
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTriangleStrip(Vector2* points, int pointsCount, Color color);
+ public static extern void DrawTriangleStrip(Vector2* points, int pointCount, Color color);
/// Draw a regular polygon (Vector version)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1002,7 +1088,14 @@ namespace Raylib_cs
/// 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);
+ public static extern void DrawPolyLinesEx(
+ Vector2 center,
+ int sides,
+ float radius,
+ float rotation,
+ float lineThick,
+ Color color
+ );
// Basic shapes collision detection functions
@@ -1012,7 +1105,12 @@ namespace Raylib_cs
/// Check collision between two circles
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2);
+ public static extern CBool CheckCollisionCircles(
+ Vector2 center1,
+ float radius1,
+ Vector2 center2,
+ float radius2
+ );
/// Check collision between circle and rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1030,11 +1128,25 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);
- /// Check the collision between two lines defined by two points each, returns collision point by reference
+ /// Check if point is within a polygon described by array of vertices
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2* collisionPoint);
+ public static extern CBool CheckCollisionPointPoly(Vector2 point, Vector2* points, int pointCount);
- /// Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
+ ///
+ /// Check the collision between two lines defined by two points each, returns collision point by reference
+ ///
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool CheckCollisionLines(
+ Vector2 startPos1,
+ Vector2 endPos1,
+ Vector2 startPos2,
+ Vector2 endPos2,
+ 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 CBool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold);
@@ -1056,7 +1168,13 @@ namespace Raylib_cs
/// Load image from RAW file data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Image LoadImageRaw(sbyte* fileName, int width, int height, PixelFormat format, int headerSize);
+ public static extern Image LoadImageRaw(
+ sbyte* fileName,
+ int width,
+ int height,
+ PixelFormat format,
+ int headerSize
+ );
/// Load image sequence from file (frames appended to image.data)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1074,6 +1192,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image LoadImageFromScreen();
+ /// Check if an image is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsImageReady(Image image);
+
/// Unload image from CPU memory (RAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadImage(Image image);
@@ -1103,20 +1225,41 @@ namespace Raylib_cs
/// Generate image: radial gradient
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);
+ public static extern Image GenImageGradientRadial(
+ int width,
+ int height,
+ float density,
+ Color inner,
+ Color outer
+ );
/// Generate image: checked
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2);
+ public static extern Image GenImageChecked(
+ int width,
+ int height,
+ int checksX,
+ int checksY,
+ Color col1,
+ Color col2
+ );
/// Generate image: white noise
[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);
+ /// Generate image: grayscale image from text data
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Image GenImageText(int width, int height, int tileSize);
+
// Image manipulation functions
@@ -1136,33 +1279,37 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image ImageTextEx(Font font, sbyte* text, float fontSize, float spacing, Color tint);
- /// Convert image to POT (power-of-two)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageToPOT(Image* image, Color fill);
-
/// Convert image data to desired format
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageFormat(Image* image, PixelFormat newFormat);
- /// Apply alpha mask to image
+ /// Convert image to POT (power-of-two)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageAlphaMask(Image* image, Image alphaMask);
+ public static extern void ImageToPOT(Image* image, Color fill);
- /// Clear alpha channel to desired color
+ /// Crop an image to a defined rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageAlphaClear(Image* image, Color color, float threshold);
+ public static extern void ImageCrop(Image* image, Rectangle crop);
/// Crop image depending on alpha value
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageAlphaCrop(Image* image, float threshold);
+ /// Clear alpha channel to desired color
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageAlphaClear(Image* image, Color color, float threshold);
+
+ /// Apply alpha mask to image
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageAlphaMask(Image* image, Image alphaMask);
+
/// Premultiply alpha channel
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageAlphaPremultiply(Image* image);
- /// Crop an image to a defined rectangle
+ /// Apply Gaussian blur using a box blur approximation
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageCrop(Image* image, Rectangle crop);
+ public static extern void ImageBlurGaussian(Image* image, int blurSize);
/// Resize image (Bicubic scaling algorithm)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1174,7 +1321,14 @@ namespace Raylib_cs
/// Resize canvas and fill with color
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageResizeCanvas(Image* image, int newWidth, int newHeight, int offsetX, int offsetY, Color color);
+ public static extern void ImageResizeCanvas(
+ Image* image,
+ int newWidth,
+ int newHeight,
+ int offsetX,
+ int offsetY,
+ Color color
+ );
/// Generate all mipmap levels for a provided image
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1230,7 +1384,7 @@ namespace Raylib_cs
/// Load colors palette from image as a Color array (RGBA - 32bit)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Color* LoadImagePalette(Image image, int maxPaletteSize, int* colorsCount);
+ public static extern Color* LoadImagePalette(Image image, int maxPaletteSize, int* colorCount);
/// Unload color data loaded with LoadImageColors()
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1266,7 +1420,14 @@ namespace Raylib_cs
/// Draw line within an image
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageDrawLine(Image* dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color);
+ public static extern void ImageDrawLine(
+ Image* dst,
+ int startPosX,
+ int startPosY,
+ int endPosX,
+ int endPosY,
+ Color color
+ );
/// Draw line within an image (Vector version)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1280,9 +1441,24 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawCircleV(Image* dst, Vector2 center, int radius, Color color);
+ /// Draw circle outline within an image
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawCircleLines(Image* dst, int centerX, int centerY, int radius, Color color);
+
+ /// Draw circle outline within an image (Vector version)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawCircleLinesV(Image* dst, Vector2 center, int radius, Color color);
+
/// Draw rectangle within an image
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageDrawRectangle(Image* dst, int posX, int posY, int width, int height, Color color);
+ public static extern void ImageDrawRectangle(
+ Image* dst,
+ int posX,
+ int posY,
+ int width,
+ int height,
+ Color color
+ );
/// Draw rectangle within an image (Vector version)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1306,7 +1482,15 @@ namespace Raylib_cs
/// Draw text (custom sprite font) within an image (destination)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void ImageDrawTextEx(Image* dst, Font font, sbyte* text, Vector2 position, float fontSize, float spacing, Color tint);
+ public static extern void ImageDrawTextEx(
+ Image* dst,
+ Font font,
+ sbyte* text,
+ Vector2 position,
+ float fontSize,
+ float spacing,
+ Color tint
+ );
// Texture loading functions
@@ -1328,10 +1512,18 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern RenderTexture2D LoadRenderTexture(int width, int height);
+ /// Check if a texture is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsTextureReady(Texture2D texture);
+
/// Unload texture from GPU memory (VRAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadTexture(Texture2D texture);
+ /// Check if a render texture is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsRenderTextureReady(RenderTexture2D target);
+
/// Unload render texture from GPU memory (VRAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadRenderTexture(RenderTexture2D target);
@@ -1372,31 +1564,39 @@ namespace Raylib_cs
/// Draw a Texture2D with extended parameters
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint);
+ public static extern void DrawTextureEx(
+ Texture2D texture,
+ Vector2 position,
+ float rotation,
+ float scale,
+ Color tint
+ );
/// Draw a part of a texture defined by a rectangle
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint);
- /// Draw texture quad with tiling and offset parameters
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint);
-
- /// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint);
-
/// Draw a part of a texture defined by a rectangle with 'pro' parameters
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint);
+ public static extern void DrawTexturePro(
+ Texture2D texture,
+ Rectangle source,
+ Rectangle dest,
+ Vector2 origin,
+ float rotation,
+ Color tint
+ );
/// Draws a texture (or part of it) that stretches or shrinks nicely
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint);
-
- /// Draw a textured polygon
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2* points, Vector2* texcoords, int pointsCount, Color tint);
+ public static extern void DrawTextureNPatch(
+ Texture2D texture,
+ NPatchInfo nPatchInfo,
+ Rectangle dest,
+ Vector2 origin,
+ float rotation,
+ Color tint
+ );
// Color/pixel related functions
@@ -1421,6 +1621,18 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorFromHSV(float hue, float saturation, float value);
+ /// Get color multiplied with another color
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Color ColorTint(Color color, Color tint);
+
+ /// Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Color ColorBrightness(Color color, float factor);
+
+ /// Get color with contrast correction, contrast values between -1.0f and 1.0f
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Color ColorContrast(Color color, float contrast);
+
/// 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);
@@ -1473,15 +1685,40 @@ namespace Raylib_cs
/// Load font from memory buffer, fileType refers to extension: i.e. "ttf"
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Font LoadFontFromMemory(sbyte* fileType, byte* fileData, int dataSize, int fontSize, int* fontChars, int glyphCount);
+ public static extern Font LoadFontFromMemory(
+ sbyte* fileType,
+ byte* fileData,
+ int dataSize,
+ int fontSize,
+ int* fontChars,
+ int glyphCount
+ );
+
+ /// Check if a font is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsFontReady(Font font);
/// Load font data for further use
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern GlyphInfo* LoadFontData(byte* fileData, int dataSize, int fontSize, int* fontChars, int glyphCount, FontType type);
+ public static extern GlyphInfo* LoadFontData(
+ byte* fileData,
+ int dataSize,
+ int fontSize,
+ int* fontChars,
+ int glyphCount,
+ FontType type
+ );
/// Generate image font atlas using chars info
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Image GenImageFontAtlas(GlyphInfo* chars, Rectangle** recs, int glyphCount, int fontSize, int padding, int packMethod);
+ public static extern Image GenImageFontAtlas(
+ GlyphInfo* chars,
+ Rectangle** recs,
+ int glyphCount,
+ int fontSize,
+ int padding,
+ int packMethod
+ );
/// Unload font chars info data (RAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1508,19 +1745,49 @@ namespace Raylib_cs
/// Draw text using font and additional parameters
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextEx(Font font, sbyte* text, Vector2 position, float fontSize, float spacing, Color tint);
+ public static extern void DrawTextEx(
+ Font font,
+ sbyte* text,
+ Vector2 position,
+ float fontSize,
+ float spacing,
+ Color tint
+ );
/// Draw text using Font and pro parameters (rotation)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextPro(Font font, sbyte* text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint);
+ public static extern void DrawTextPro(
+ Font font,
+ sbyte* text,
+ Vector2 position,
+ Vector2 origin,
+ float rotation,
+ float fontSize,
+ float spacing,
+ Color tint
+ );
/// Draw one character (codepoint)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, 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);
+ public static extern void DrawTextCodepoints(
+ Font font,
+ int* codepoints,
+ int count,
+ Vector2 position,
+ float fontSize,
+ float spacing,
+ Color tint
+ );
// Text font info functions
@@ -1532,22 +1799,36 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 MeasureTextEx(Font font, sbyte* text, float fontSize, float spacing);
- /// Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
+ ///
+ /// 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
+ ///
+ /// 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
+ ///
+ /// 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 codepoints management functions (unicode characters)
- /// Get all codepoints in a string, codepoints count returned by parameters
+ /// Load UTF-8 text encoded from codepoints array
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern sbyte* LoadUTF8(int* codepoints, int length);
+
+ /// Unload UTF-8 text encoded from codepoints array
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void UnloadUTF8(int* text);
+
+ /// Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int* LoadCodepoints(sbyte* text, int* count);
@@ -1555,21 +1836,25 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadCodepoints(int* codepoints);
- /// Get total number of characters (codepoints) in a UTF8 encoded string
+ /// Get total number of codepoints in a UTF8 encoded string
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetCodepointCount(sbyte* text);
- /// Get next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
+ /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetCodepoint(sbyte* text, int* bytesProcessed);
+ public static extern int GetCodepoint(sbyte* text, int* codepointSize);
- /// Encode codepoint into utf8 text (char array length returned as parameter)
+ /// Get next codepoint in a UTF-8 encoded string; 0x3f('?') is returned on failure
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern sbyte* CodepointToUTF8(int codepoint, int* byteSize);
+ public static extern int GetCodepointNext(sbyte* text, int* codepointSize);
- /// Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)
+ /// Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern sbyte* TextCodepointsToUTF8(int* codepoints, int length);
+ public static extern int GetCodepointPrevious(sbyte* text, int* codepointSize);
+
+ /// Encode one codepoint into UTF-8 byte array (array length returned as parameter)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern sbyte* CodepointToUTF8(int codepoint, int* utf8Size);
// Text strings management functions (no UTF-8 strings, only byte chars)
@@ -1652,7 +1937,13 @@ namespace Raylib_cs
/// Draw a circle in 3D world space
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color);
+ public static extern void DrawCircle3D(
+ Vector3 center,
+ float radius,
+ Vector3 rotationAxis,
+ float rotationAngle,
+ Color color
+ );
/// Draw a color-filled triangle (vertex in counter-clockwise order!)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1660,7 +1951,7 @@ namespace Raylib_cs
/// Draw a triangle strip defined by points
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawTriangleStrip3D(Vector3* points, int pointsCount, Color color);
+ public static extern void DrawTriangleStrip3D(Vector3* points, int pointCount, Color color);
/// Draw cube
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1678,14 +1969,6 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawCubeWiresV(Vector3 position, Vector3 size, Color color);
- /// Draw cube textured
- [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);
@@ -1700,19 +1983,69 @@ namespace Raylib_cs
/// Draw a cylinder/cone
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
+ 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);
+ 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);
+ 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);
+ public static extern void DrawCylinderWiresEx(
+ Vector3 startPos,
+ Vector3 endPos,
+ float startRadius,
+ float endRadius,
+ int sides,
+ Color color
+ );
+
+ /// Draw a capsule with the center of its sphere caps at startPos and endPos
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawCapsule(
+ Vector3 startPos,
+ Vector3 endPos,
+ float radius,
+ int slices,
+ int rings,
+ Color color
+ );
+
+ /// Draw capsule wireframe with the center of its sphere caps at startPos and endPos
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawCapsuleWires(
+ Vector3 startPos,
+ Vector3 endPos,
+ float radius,
+ int slices,
+ int rings,
+ Color color
+ );
/// Draw a plane XZ
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1731,7 +2064,7 @@ namespace Raylib_cs
// Model 3d Loading and Drawing Functions (Module: models)
//------------------------------------------------------------------------------------
- // Model loading/unloading functions
+ // Model management functions
/// Load model from files (meshes and materials)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1741,19 +2074,92 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Model LoadModelFromMesh(Mesh mesh);
+ /// Check if a model is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsModelReady(Model model);
+
/// Unload model from memory (RAM and/or VRAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadModel(Model model);
- /// Unload model (but not meshes) from memory (RAM and/or VRAM)
- [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
+
+ // Model drawing functions
+
+ /// Draw a model (with texture if set)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModel(Model model, Vector3 position, float scale, Color tint);
+
+ /// Draw a model with extended parameters
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModelEx(
+ Model model,
+ Vector3 position,
+ Vector3 rotationAxis,
+ float rotationAngle,
+ Vector3 scale,
+ Color tint
+ );
+
+ /// Draw a model wires (with texture if set)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModelWires(Model model, Vector3 position, float scale, Color tint);
+
+ /// Draw a model wires (with texture if set) with extended parameters
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModelWiresEx(
+ Model model,
+ Vector3 position,
+ Vector3 rotationAxis,
+ float rotationAngle,
+ Vector3 scale,
+ Color tint
+ );
+
+ /// Draw bounding box (wires)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawBoundingBox(BoundingBox box, Color color);
+
+ /// Draw a billboard texture
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawBillboard(
+ Camera3D camera,
+ Texture2D texture,
+ Vector3 center,
+ float size,
+ Color tint
+ );
+
+ /// Draw a billboard texture defined by source
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ 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)]
+ public static extern void DrawBillboardPro(
+ Camera3D camera,
+ Texture2D texture,
+ Rectangle source,
+ Vector3 position,
+ Vector3 up,
+ Vector2 size,
+ Vector2 origin,
+ float rotation,
+ Color tint
+ );
+
+
+ // Mesh management functions
/// Upload vertex data into GPU and provided VAO/VBO ids
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1787,29 +2193,6 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void GenMeshTangents(Mesh* mesh);
- // Material loading/unloading functions
-
- //TODO: safe Helper method
- /// Load materials from model file
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Material* LoadMaterials(sbyte* fileName, int* materialCount);
-
- /// Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Material LoadMaterialDefault();
-
- /// Unload material from GPU memory (VRAM)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void UnloadMaterial(Material material);
-
- /// Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetMaterialTexture(Material* material, MaterialMapIndex mapType, Texture2D texture);
-
- /// Set material for a mesh
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetModelMeshMaterial(Model* model, int meshId, int materialId);
-
// Mesh generation functions
@@ -1857,45 +2240,40 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
- // Model drawing functions
- /// Draw a model (with texture if set)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawModel(Model model, Vector3 position, float scale, Color tint);
+ // Material loading/unloading functions
- /// Draw a model with extended parameters
+ //TODO: safe Helper method
+ /// Load materials from model file
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint);
+ public static extern Material* LoadMaterials(sbyte* fileName, int* materialCount);
- /// Draw a model wires (with texture if set)
+ /// Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawModelWires(Model model, Vector3 position, float scale, Color tint);
+ public static extern Material LoadMaterialDefault();
- /// Draw a model wires (with texture if set) with extended parameters
+ /// Check if a material is ready
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint);
+ public static extern CBool IsMaterialReady();
- /// Draw bounding box (wires)
+ /// Unload material from GPU memory (VRAM)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawBoundingBox(BoundingBox box, Color color);
+ public static extern void UnloadMaterial(Material material);
- /// Draw a billboard texture
+ /// Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawBillboard(Camera3D camera, Texture2D texture, Vector3 center, float size, Color tint);
+ public static extern void SetMaterialTexture(Material* material, MaterialMapIndex mapType, Texture2D texture);
- /// Draw a billboard texture defined by source
+ /// Set material for a mesh
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint);
+ public static extern void SetModelMeshMaterial(Model* model, int meshId, int materialId);
- /// 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
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern ModelAnimation* LoadModelAnimations(sbyte* fileName, uint* animsCount);
+ public static extern ModelAnimation* LoadModelAnimations(sbyte* fileName, uint* animCount);
/// Update model animation pose
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1917,7 +2295,12 @@ namespace Raylib_cs
/// Detect collision between two spheres
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2);
+ public static extern CBool CheckCollisionSpheres(
+ Vector3 center1,
+ float radius1,
+ Vector3 center2,
+ float radius2
+ );
/// Detect collision between two bounding boxes
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1981,6 +2364,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Wave LoadWaveFromMemory(sbyte* fileType, byte* fileData, int dataSize);
+ /// Checks if wave data is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsWaveReady(Wave wave);
+
/// Load sound from file
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Sound LoadSound(sbyte* fileName);
@@ -1989,9 +2376,13 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Sound LoadSoundFromWave(Wave wave);
+ /// Checks if a sound is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsSoundReady(Sound sound);
+
/// Update sound buffer with new data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void UpdateSound(Sound sound, void* data, int samplesCount);
+ public static extern void UpdateSound(Sound sound, void* data, int sampleCount);
/// Unload wave data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2028,14 +2419,6 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ResumeSound(Sound sound);
- /// Play a sound (using multichannel buffer pool)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void PlaySoundMulti(Sound sound);
-
- /// Stop any sound playing (using multichannel buffer pool)
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void StopSoundMulti();
-
/// Get number of sounds playing in the multichannel
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetSoundsPlaying();
@@ -2087,6 +2470,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Music LoadMusicStreamFromMemory(sbyte* fileType, byte* data, int dataSize);
+ /// Checks if a music stream is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsMusicReady(Music music);
+
/// Unload music stream
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadMusicStream(Music music);
@@ -2146,13 +2533,17 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern AudioStream LoadAudioStream(uint sampleRate, uint sampleSize, uint channels);
+ /// Checks if an audio stream is ready
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsAudioStreamReady(AudioStream stream);
+
/// Unload audio stream and free memory
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadAudioStream(AudioStream stream);
/// Update audio stream buffers with data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void UpdateAudioStream(AudioStream stream, void* data, int samplesCount);
+ public static extern void UpdateAudioStream(AudioStream stream, void* data, int frameCount);
/// Check if any audio stream buffers requires refill
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2196,14 +2587,35 @@ namespace Raylib_cs
/// Audio thread callback to request new data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void SetAudioStreamCallback(AudioStream stream, delegate* unmanaged[Cdecl] callback);
+ public static extern void SetAudioStreamCallback(
+ AudioStream stream,
+ delegate* unmanaged[Cdecl] callback
+ );
/// Attach audio stream processor to stream
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void AttachAudioStreamProcessor(AudioStream stream, delegate* unmanaged[Cdecl] processor);
+ public static extern void AttachAudioStreamProcessor(
+ AudioStream stream,
+ delegate* unmanaged[Cdecl] processor
+ );
/// Detach audio stream processor from stream
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void DetachAudioStreamProcessor(AudioStream stream, delegate* unmanaged[Cdecl] processor);
+ public static extern void DetachAudioStreamProcessor(
+ AudioStream stream,
+ delegate* unmanaged[Cdecl] processor
+ );
+
+ /// Attach audio stream processor to the entire audio pipeline
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void AttachAudioMixedProcessor(
+ delegate* unmanaged[Cdecl] processor
+ );
+
+ /// Detach audio stream processor from the entire audio pipeline
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DetachAudioMixedProcessor(
+ delegate* unmanaged[Cdecl] processor
+ );
}
}
diff --git a/Raylib-cs/interop/Raymath.cs b/Raylib-cs/interop/Raymath.cs
index eae874f..85e0609 100644
--- a/Raylib-cs/interop/Raymath.cs
+++ b/Raylib-cs/interop/Raymath.cs
@@ -37,7 +37,13 @@ namespace Raylib_cs
/// Remap input value within input range to output range
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd);
+ public static extern float Remap(
+ float value,
+ float inputStart,
+ float inputEnd,
+ float outputStart,
+ float outputEnd
+ );
/// Wrap input value from min to max
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -91,10 +97,21 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
- /// Calculate angle from two vectors
+ ///
+ /// Calculate angle between two vectors
+ /// NOTE: Angle is calculated from origin point (0, 0)
+ ///
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
+ ///
+ /// Calculate angle defined by a two vectors line
+ /// NOTE: Parameters need to be normalized
+ /// Current implementation should be aligned with glm::angle
+ ///
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern float Vector2LineAngle(Vector2 start, Vector2 end);
+
/// Scale vector (multiply by value)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
@@ -387,7 +404,14 @@ namespace Raylib_cs
/// Get perspective projection matrix
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Matrix4x4 MatrixFrustum(double left, double right, double bottom, double top, double near, double far);
+ public static extern Matrix4x4 MatrixFrustum(
+ double left,
+ double right,
+ double bottom,
+ double top,
+ double near,
+ double far
+ );
///
/// Get perspective projection matrix
@@ -398,7 +422,14 @@ namespace Raylib_cs
/// Get orthographic projection matrix
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Matrix4x4 MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
+ public static extern Matrix4x4 MatrixOrtho(
+ double left,
+ double right,
+ double bottom,
+ double top,
+ double near,
+ double far
+ );
/// Get camera look-at matrix (view matrix)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
diff --git a/Raylib-cs/interop/Rlgl.cs b/Raylib-cs/interop/Rlgl.cs
index 5413c39..4203833 100644
--- a/Raylib-cs/interop/Rlgl.cs
+++ b/Raylib-cs/interop/Rlgl.cs
@@ -33,13 +33,13 @@ namespace Raylib_cs
public const int RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 0x2701;
public const int RL_TEXTURE_FILTER_MIP_LINEAR = 0x2703;
public const int RL_TEXTURE_FILTER_ANISOTROPIC = 0x3000;
+ public const int RL_TEXTURE_MIPMAP_BIAS_RATIO = 0x4000;
public const int RL_TEXTURE_WRAP_REPEAT = 0x2901;
public const int RL_TEXTURE_WRAP_CLAMP = 0x812F;
public const int RL_TEXTURE_WRAP_MIRROR_REPEAT = 0x8370;
public const int RL_TEXTURE_WRAP_MIRROR_CLAMP = 0x8742;
-
// GL equivalent data types
public const int RL_UNSIGNED_BYTE = 0x1401;
public const int RL_FLOAT = 0x1406;
@@ -55,6 +55,37 @@ namespace Raylib_cs
public const int RL_DYNAMIC_READ = 0x88E9;
public const int RL_DYNAMIC_COPY = 0x88EA;
+ // GL blending factors
+ public const int RL_ZERO = 0;
+ public const int RL_ONE = 1;
+ public const int RL_SRC_COLOR = 0x0300;
+ public const int RL_ONE_MINUS_SRC_COLOR = 0x0301;
+ public const int RL_SRC_ALPHA = 0x0302;
+ public const int RL_ONE_MINUS_SRC_ALPHA = 0x0303;
+ public const int RL_DST_ALPHA = 0x0304;
+ public const int RL_ONE_MINUS_DST_ALPHA = 0x0305;
+ public const int RL_DST_COLOR = 0x0306;
+ public const int RL_ONE_MINUS_DST_COLOR = 0x0307;
+ public const int RL_SRC_ALPHA_SATURATE = 0x0308;
+ public const int RL_CONSTANT_COLOR = 0x8001;
+ public const int RL_ONE_MINUS_CONSTANT_COLOR = 0x8002;
+ public const int RL_CONSTANT_ALPHA = 0x8003;
+ public const int RL_ONE_MINUS_CONSTANT_ALPHA = 0x8004;
+
+ // GL blending functions/equations
+ public const int RL_FUNC_ADD = 0x8006;
+ public const int RL_MIN = 0x8007;
+ public const int RL_MAX = 0x8008;
+ public const int RL_FUNC_SUBTRACT = 0x800A;
+ public const int RL_FUNC_REVERSE_SUBTRACT = 0x800B;
+ public const int RL_BLEND_EQUATION = 0x8009;
+ public const int RL_BLEND_EQUATION_RGB = 0x8009;
+ public const int RL_BLEND_EQUATION_ALPHA = 0x883D;
+ public const int RL_BLEND_DST_RGB = 0x80C8;
+ public const int RL_BLEND_SRC_RGB = 0x80C9;
+ public const int RL_BLEND_DST_ALPHA = 0x80CA;
+ public const int RL_BLEND_SRC_ALPHA = 0x80CB;
+ public const int RL_BLEND_COLOR = 0x8005;
// ------------------------------------------------------------------------------------
// Functions Declaration - Matrix operations
@@ -109,10 +140,24 @@ namespace Raylib_cs
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
+ public static extern void rlFrustum(
+ double left,
+ double right,
+ double bottom,
+ double top,
+ double znear,
+ double zfar
+ );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar);
+ public static extern void rlOrtho(
+ double left,
+ double right,
+ double bottom,
+ double top,
+ double znear,
+ double zfar
+ );
/// Set the viewport area
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -245,6 +290,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlTextureParameters(uint id, int param, int value);
+ /// Set cubemap parameters (filter, wrap)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlCubemapParameters(uint id, int param, int value);
+
// Shader state
@@ -306,6 +355,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlDisableBackfaceCulling();
+ /// Set face culling mode
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlSetCullFace(int mode);
+
/// Enable scissor test
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlEnableScissorTest();
@@ -374,6 +427,17 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation);
+ /// Set blending mode factors and equations separately (using OpenGL factors)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlSetBlendFactorsSeparate(
+ int glSrcRGB,
+ int glDstRGB,
+ int glSrcAlpha,
+ int glDstAlpha,
+ int glEqRGB,
+ int glEqAlpha
+ );
+
// ------------------------------------------------------------------------------------
// Functions Declaration - rlgl functionality
@@ -477,7 +541,14 @@ namespace Raylib_cs
public static extern void rlUnloadVertexBuffer(uint vboId);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlSetVertexAttribute(uint index, int compSize, int type, CBool normalized, int stride, void* pointer);
+ public static extern void rlSetVertexAttribute(
+ uint index,
+ int compSize,
+ int type,
+ CBool normalized,
+ int stride,
+ void* pointer
+ );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlSetVertexAttributeDivisor(uint index, int divisor);
@@ -496,7 +567,12 @@ namespace Raylib_cs
public static extern void rlDrawVertexArrayInstanced(int offset, int count, int instances);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlDrawVertexArrayElementsInstanced(int offset, int count, void* buffer, int instances);
+ public static extern void rlDrawVertexArrayElementsInstanced(
+ int offset,
+ int count,
+ void* buffer,
+ int instances
+ );
// Textures data management
@@ -515,11 +591,24 @@ namespace Raylib_cs
/// Update GPU texture with new data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlUpdateTexture(uint id, int offsetX, int offsetY, 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)]
- public static extern void rlGetGlTextureFormats(PixelFormat format, int* glInternalFormat, int* glFormat, int* glType);
+ public static extern void rlGetGlTextureFormats(
+ PixelFormat format,
+ int* glInternalFormat,
+ int* glFormat,
+ int* glType
+ );
/// Get OpenGL internal formats
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -550,7 +639,13 @@ namespace Raylib_cs
/// Attach texture/renderbuffer to a framebuffer
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlFramebufferAttach(uint fboId, uint texId, FramebufferAttachType attachType, FramebufferAttachTextureType texType, int mipLevel);
+ public static extern void rlFramebufferAttach(
+ uint fboId,
+ uint texId,
+ FramebufferAttachType attachType,
+ FramebufferAttachTextureType texType,
+ int mipLevel
+ );
/// Verify framebuffer is complete
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -558,7 +653,7 @@ namespace Raylib_cs
/// Delete framebuffer from GPU
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool rlUnloadFramebuffer(uint id);
+ public static extern void rlUnloadFramebuffer(uint id);
// Shaders management
@@ -615,9 +710,12 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlComputeShaderDispatch(uint groupX, uint groupY, uint groupZ);
+
+ // Shader buffer storage object management (ssbo)
+
/// Load shader storage buffer object (SSBO)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern uint rlLoadShaderBuffer(ulong size, void* data, int usageHint);
+ public static extern uint rlLoadShaderBuffer(uint size, void* data, int usageHint);
/// Unload shader storage buffer object (SSBO)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -625,30 +723,36 @@ namespace Raylib_cs
/// Update SSBO buffer data
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlUpdateShaderBufferElements(uint id, void* data, ulong dataSize, ulong offset);
+ public static extern void rlUpdateShaderBuffer(uint id, void* data, uint dataSize, uint offset);
+
+ /// Bind SSBO buffer data
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlBindShaderBuffer(uint id, uint index);
+
+ /// Read SSBO buffer data (GPU->CPU)
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlReadShaderBuffer(uint id, void* dest, uint count, uint offset);
+
+ /// Copy SSBO data between buffers
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void rlCopyShaderBuffer(
+ uint destId,
+ uint srcId,
+ uint destOffset,
+ uint srcOffset,
+ uint count
+ );
/// Get SSBO buffer size
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern ulong rlGetShaderBufferSize(uint id, void* dest, ulong count, ulong offset);
-
- /// Bind SSBO buffer
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlReadShaderBufferElements(uint id, void* dest, ulong count, ulong offset);
-
- /// Copy SSBO buffer data
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlBindShaderBuffer(uint id, uint index);
+ public static extern uint rlGetShaderBufferSize(uint id);
// Buffer management
- /// Copy SSBO buffer data
- [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlCopyBuffersElements(uint destId, uint srcId, ulong destOffset, ulong srcOffset, ulong count);
-
/// Bind image texture
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void rlBindImageTexture(uint id, uint index, uint format, int readOnly);
+ public static extern void rlBindImageTexture(uint id, uint index, int format, CBool readOnly);
// Matrix state management
diff --git a/Raylib-cs/types/Core.cs b/Raylib-cs/types/Core.cs
index 40042c2..d377c13 100644
--- a/Raylib-cs/types/Core.cs
+++ b/Raylib-cs/types/Core.cs
@@ -169,8 +169,13 @@ namespace Raylib_cs
BLEND_ALPHA_PREMULTIPLY,
///
- /// Blend textures using custom src/dst factors (use rlSetBlendMode())
+ /// Blend textures using custom src/dst factors (use rlSetBlendFactors())
///
- BLEND_CUSTOM
+ BLEND_CUSTOM,
+
+ ///
+ /// Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
+ ///
+ BLEND_CUSTOM_SEPARATE
}
}
diff --git a/Raylib-cs/types/Input.cs b/Raylib-cs/types/Input.cs
index 4bf82d5..c5d254f 100644
--- a/Raylib-cs/types/Input.cs
+++ b/Raylib-cs/types/Input.cs
@@ -229,7 +229,7 @@ namespace Raylib_cs
MOUSE_CURSOR_RESIZE_NESW = 8,
///
- /// The omni-directional resize/move cursor shape
+ /// The omnidirectional resize/move cursor shape
///
MOUSE_CURSOR_RESIZE_ALL = 9,
@@ -332,12 +332,12 @@ namespace Raylib_cs
/// Gamepad top/back trigger left (second), it could be a trailing button
///
GAMEPAD_BUTTON_LEFT_TRIGGER_2,
-
+
///
/// Gamepad top/back trigger right (first), it could be a trailing button
///
GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
-
+
///
/// Gamepad top/back trigger right (second), it could be a trailing button
///
diff --git a/Raylib-cs/types/Ray.cs b/Raylib-cs/types/Ray.cs
index 93007c7..0641fff 100644
--- a/Raylib-cs/types/Ray.cs
+++ b/Raylib-cs/types/Ray.cs
@@ -38,12 +38,12 @@ namespace Raylib_cs
public CBool hit;
///
- /// Distance to nearest hit
+ /// Distance to the nearest hit
///
public float distance;
///
- /// Position of nearest hit
+ /// Point of the nearest hit
///
public Vector3 point;
diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs
index 9cc9a14..46a8b60 100644
--- a/Raylib-cs/types/Raylib.Utils.cs
+++ b/Raylib-cs/types/Raylib.Utils.cs
@@ -137,43 +137,61 @@ namespace Raylib_cs
}
/// Set shader uniform value vector
- public static void SetShaderValueV(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType, int count)
- where T : unmanaged
+ public static void SetShaderValueV(
+ Shader shader,
+ int locIndex,
+ T[] values,
+ ShaderUniformDataType uniformType,
+ int count
+ ) where T : unmanaged
{
- SetShaderValueV(shader, uniformLoc, (Span)values, uniformType, count);
+ SetShaderValueV(shader, locIndex, (Span)values, uniformType, count);
}
/// Set shader uniform value vector
- public static void SetShaderValueV(Shader shader, int uniformLoc, Span values, ShaderUniformDataType uniformType, int count)
- where T : unmanaged
+ public static void SetShaderValueV(
+ Shader shader,
+ int locIndex,
+ Span values,
+ ShaderUniformDataType uniformType,
+ int count
+ ) where T : unmanaged
{
fixed (T* valuePtr = values)
{
- SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count);
+ SetShaderValueV(shader, locIndex, valuePtr, uniformType, count);
}
}
/// Set shader uniform value
- public static void SetShaderValue(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType)
+ public static void SetShaderValue(Shader shader, int locIndex, T value, ShaderUniformDataType uniformType)
where T : unmanaged
{
- SetShaderValue(shader, uniformLoc, &value, uniformType);
+ SetShaderValue(shader, locIndex, &value, uniformType);
}
/// Set shader uniform value
- public static void SetShaderValue(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType)
- where T : unmanaged
+ public static void SetShaderValue(
+ Shader shader,
+ int locIndex,
+ T[] values,
+ ShaderUniformDataType uniformType
+ ) where T : unmanaged
{
- SetShaderValue(shader, uniformLoc, (Span)values, uniformType);
+ SetShaderValue(shader, locIndex, (Span)values, uniformType);
}
/// Set shader uniform value
- public static void SetShaderValue(Shader shader, int uniformLoc, Span values, ShaderUniformDataType uniformType)
- where T : unmanaged
+ public static void SetShaderValue(
+ Shader shader,
+ int locIndex,
+ Span values,
+ ShaderUniformDataType uniformType
+ ) where T : unmanaged
{
fixed (T* valuePtr = values)
{
- SetShaderValue(shader, uniformLoc, valuePtr, uniformType);
+ SetShaderValue(shader, locIndex, valuePtr, uniformType);
}
}
@@ -209,16 +227,24 @@ namespace Raylib_cs
}
/// Update camera position for selected mode
- public static void UpdateCamera(ref Camera3D camera)
+ public static void UpdateCamera(ref Camera3D camera, CameraMode mode)
{
fixed (Camera3D* c = &camera)
{
- UpdateCamera(c);
+ UpdateCamera(c, mode);
}
}
- /// Check the collision between two lines defined by two points each, returns collision point by reference
- public static CBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint)
+ ///
+ /// Check the collision between two lines defined by two points each, returns collision point by reference
+ ///
+ public static CBool CheckCollisionLines(
+ Vector2 startPos1,
+ Vector2 endPos1,
+ Vector2 startPos2,
+ Vector2 endPos2,
+ ref Vector2 collisionPoint
+ )
{
fixed (Vector2* p = &collisionPoint)
{
@@ -322,7 +348,14 @@ namespace Raylib_cs
}
/// Resize canvas and fill with color
- 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)
{
@@ -466,7 +499,14 @@ namespace Raylib_cs
}
/// Draw line within an image
- public static void ImageDrawLine(ref Image dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color)
+ public static void ImageDrawLine(
+ ref Image dst,
+ int startPosX,
+ int startPosY,
+ int endPosX,
+ int endPosY,
+ Color color
+ )
{
fixed (Image* p = &dst)
{
@@ -557,7 +597,15 @@ namespace Raylib_cs
}
/// Draw text (custom sprite font) within an image (destination)
- public static void ImageDrawTextEx(ref Image dst, Font font, string text, Vector2 position, int fontSize, float spacing, Color color)
+ public static void ImageDrawTextEx(
+ ref Image dst,
+ Font font,
+ string text,
+ Vector2 position,
+ int fontSize,
+ float spacing,
+ Color color
+ )
{
using var str1 = text.ToUTF8Buffer();
fixed (Image* p = &dst)
@@ -636,19 +684,19 @@ namespace Raylib_cs
}
/// Load model animations from file
- public static ReadOnlySpan LoadModelAnimations(string fileName, ref uint animsCount)
+ public static ReadOnlySpan LoadModelAnimations(string fileName, ref uint animCount)
{
using var str1 = fileName.ToUTF8Buffer();
- fixed (uint* p = &animsCount)
+ fixed (uint* p = &animCount)
{
- var model = LoadModelAnimations(str1.AsPointer(), p);
+ ModelAnimation* modelAnimations = LoadModelAnimations(str1.AsPointer(), p);
- if ((IntPtr)model == IntPtr.Zero)
+ if ((IntPtr)modelAnimations == IntPtr.Zero)
{
throw new ApplicationException("Failed to load animation");
}
- return new ReadOnlySpan(model, (int)animsCount);
+ return new ReadOnlySpan(modelAnimations, (int)animCount);
}
}
@@ -680,41 +728,29 @@ namespace Raylib_cs
}
/// Draw lines sequence
- public static void DrawLineStrip(Vector2[] points, int numPoints, Color color)
+ public static void DrawLineStrip(Vector2[] points, int pointCount, Color color)
{
fixed (Vector2* p = points)
{
- DrawLineStrip(p, numPoints, color);
+ DrawLineStrip(p, pointCount, color);
}
}
/// Draw a triangle fan defined by points (first vertex is the center)
- public static void DrawTriangleFan(Vector2[] points, int numPoints, Color color)
+ public static void DrawTriangleFan(Vector2[] points, int pointCount, Color color)
{
fixed (Vector2* p = points)
{
- DrawTriangleFan(p, numPoints, color);
+ DrawTriangleFan(p, pointCount, color);
}
}
/// Draw a triangle strip defined by points
- public static void DrawTriangleStrip(Vector2[] points, int pointsCount, Color color)
+ public static void DrawTriangleStrip(Vector2[] points, int pointCount, Color color)
{
fixed (Vector2* p = points)
{
- DrawTriangleStrip(p, pointsCount, color);
- }
- }
-
- /// Draw a textured polygon
- public static void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2[] points, Vector2[] texcoords, int pointsCount, Color tint)
- {
- fixed (Vector2* p = points)
- {
- fixed (Vector2* p1 = texcoords)
- {
- DrawTexturePoly(texture, center, p, p1, pointsCount, tint);
- }
+ DrawTriangleStrip(p, pointCount, color);
}
}
@@ -726,14 +762,30 @@ namespace Raylib_cs
}
/// Draw text using font and additional parameters
- public static void DrawTextEx(Font font, string text, Vector2 position, float fontSize, float spacing, Color tint)
+ public static void DrawTextEx(
+ Font font,
+ string text,
+ Vector2 position,
+ float fontSize,
+ float spacing,
+ Color tint
+ )
{
using var str1 = text.ToUTF8Buffer();
DrawTextEx(font, str1.AsPointer(), position, fontSize, spacing, tint);
}
/// Draw text using Font and pro parameters (rotation)
- public static void DrawTextPro(Font font, string text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint)
+ public static void DrawTextPro(
+ Font font,
+ string text,
+ Vector2 position,
+ Vector2 origin,
+ float rotation,
+ float fontSize,
+ float spacing,
+ Color tint
+ )
{
using var str1 = text.ToUTF8Buffer();
DrawTextPro(font, str1.AsPointer(), position, origin, rotation, fontSize, spacing, tint);
@@ -788,40 +840,40 @@ namespace Raylib_cs
}
}
- /// Get total number of characters (codepoints) in a UTF8 encoded string
+ /// Get total number of codepoints in a UTF8 encoded string
public static int GetCodepointCount(string text)
{
using var str1 = text.ToUTF8Buffer();
return GetCodepointCount(str1.AsPointer());
}
- /// Get next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
+ /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
/// single codepoint / "char"
- public static int GetCodepoint(string text, ref int bytesProcessed)
+ public static int GetCodepoint(string text, ref int codepointSize)
{
using var str1 = text.ToUTF8Buffer();
- fixed (int* p = &bytesProcessed)
+ fixed (int* p = &codepointSize)
{
- return GetCodepoint(str1.AsPointer(), p);
+ return GetCodepointNext(str1.AsPointer(), p);
}
}
- /// Encode codepoint into utf8 text (char array length returned as parameter)
- public static string CodepointToUTF8(int codepoint, ref int byteSize)
+ /// Encode one codepoint into UTF-8 byte array (array length returned as parameter)
+ public static string CodepointToUTF8(int codepoint, ref int utf8Size)
{
- fixed (int* l1 = &byteSize)
+ fixed (int* l1 = &utf8Size)
{
var ptr = CodepointToUTF8(codepoint, l1);
return Utf8StringUtils.GetUTF8String(ptr);
}
}
- /// Encode codepoint into utf8 text (char array length returned as parameter)
- public static string TextCodepointsToUTF8(int[] codepoints, int length)
+ /// Load UTF-8 text encoded from codepoints array
+ public static string LoadUTF8(int[] codepoints, int length)
{
fixed (int* c1 = codepoints)
{
- var ptr = TextCodepointsToUTF8(c1, length);
+ var ptr = LoadUTF8(c1, length);
var text = Utf8StringUtils.GetUTF8String(ptr);
MemFree(ptr);
return text;
@@ -843,11 +895,11 @@ namespace Raylib_cs
}
/// Draw a triangle strip defined by points
- public static void DrawTriangleStrip3D(Vector3[] points, int pointsCount, Color color)
+ public static void DrawTriangleStrip3D(Vector3[] points, int pointCount, Color color)
{
fixed (Vector3* p = points)
{
- DrawTriangleStrip3D(p, pointsCount, color);
+ DrawTriangleStrip3D(p, pointCount, color);
}
}
@@ -910,7 +962,12 @@ namespace Raylib_cs
return model.materials[materialIndex].maps[(int)mapIndex].texture;
}
- 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], mapIndex, texture);
}
diff --git a/Raylib-cs/types/Texture2D.cs b/Raylib-cs/types/Texture2D.cs
index 313ea43..93115e2 100644
--- a/Raylib-cs/types/Texture2D.cs
+++ b/Raylib-cs/types/Texture2D.cs
@@ -82,7 +82,7 @@ namespace Raylib_cs
CUBEMAP_LAYOUT_LINE_VERTICAL,
///
- /// Layout is defined by an horizontal line with faces
+ /// Layout is defined by a horizontal line with faces
///
CUBEMAP_LAYOUT_LINE_HORIZONTAL,