using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Reflection; using System.Security; using System.IO; [assembly: DisableRuntimeMarshalling] namespace Raylib_cs; [SuppressUnmanagedCodeSecurity] public static unsafe partial class Raylib { /// /// Used by LibraryImport to load the native library /// public const string NativeLibName = "raylib"; public const string RAYLIB_VERSION = "6.0"; public const float DEG2RAD = MathF.PI / 180.0f; public const float RAD2DEG = 180.0f / MathF.PI; static Raylib() { NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), ResolveDllImport); } public static IntPtr ResolveDllImport(string libraryName, Assembly assembly, DllImportSearchPath? searchPath) { IntPtr handle = IntPtr.Zero; string libraryPath = GetLibraryPath(libraryName); if (NativeLibrary.TryLoad(libraryName, assembly, searchPath, out handle)) { return handle; } if (NativeLibrary.TryLoad(libraryPath, out handle)) { return handle; } throw new DllNotFoundException( $"Failed to load {libraryName}." ); } public static string GetLibraryPath(string libraryName) { string appBase = AppContext.BaseDirectory; string rid = GetNormalizedRuntimeIdentifier(); string path = Path.Combine(appBase, "runtimes", rid, "native"); string fileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"{libraryName}.dll" : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? $"lib{libraryName}.dylib" : $"lib{libraryName}.so"; return Path.Combine(path, fileName); } /// /// Gets a normalized runtime identifier that's consistent across different installation methods. /// https://github.com/dotnet/runtime/issues/114156#issuecomment-2773234611 /// public static string GetNormalizedRuntimeIdentifier() { string rid = RuntimeInformation.RuntimeIdentifier; // If already in the expected format, return as is if (rid == "win-x64" || rid == "win-arm64" || rid == "linux-x64" || rid == "linux-arm64" || rid == "linux-musl-x64" || rid == "linux-musl-arm64" || rid == "osx-x64" || rid == "osx-arm64") { return rid; } // Handle OS-specific RIDs from native repositories // Extract architecture (should be the part after the last dash) string architecture = "x64"; // Default if (rid.Contains("-")) { architecture = rid.Substring(rid.LastIndexOf('-') + 1); } // Determine OS and variant if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return $"win-{architecture}"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { // Check if it's Alpine Linux (musl-based) if (rid.Contains("alpine") || IsAlpineLinux()) { return $"linux-musl-{architecture}"; } return $"linux-{architecture}"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return $"osx-{architecture}"; } // Fallback to the original RID if we can't normalize it return rid; } /// /// Checks if the current Linux distribution is Alpine (musl-based). /// private static bool IsAlpineLinux() { try { // Check for /etc/os-release file which contains distribution info if (File.Exists("/etc/os-release")) { string content = File.ReadAllText("/etc/os-release"); return content.Contains("ID=alpine") || content.Contains("ID=\"alpine\""); } // Alternative check for /etc/alpine-release return File.Exists("/etc/alpine-release"); } catch { return false; } } /// /// Get color with alpha applied, alpha goes from 0.0f to 1.0f
/// NOTE: Added for compatability with previous versions ///
public static Color Fade(Color color, float alpha) => ColorAlpha(color, alpha); //------------------------------------------------------------------------------------ // Window and Graphics Device Functions (Module: core) //------------------------------------------------------------------------------------ // Window-related functions /// Initialize window and OpenGL context [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void InitWindow(int width, int height, sbyte* title); /// Check if KEY_ESCAPE pressed or Close icon pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool WindowShouldClose(); /// Close window and unload OpenGL context [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CloseWindow(); /// Check if window has been initialized successfully [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowReady(); /// Check if window is currently fullscreen [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowFullscreen(); /// Check if window is currently hidden [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowHidden(); /// Check if window is currently minimized [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowMinimized(); /// Check if window is currently maximized [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowMaximized(); /// Check if window is currently focused [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowFocused(); /// Check if window has been resized last frame [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowResized(); /// Check if one specific window flag is enabled [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWindowState(ConfigFlags flag); /// Set window configuration state using flags [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowState(ConfigFlags flag); /// Clear window configuration state flags [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ClearWindowState(ConfigFlags flag); /// Toggle window state: fullscreen/windowed, resizes monitor to match window resolution [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ToggleFullscreen(); /// Toggle window state: borderless windowed, resizes window to match monitor resolution [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ToggleBorderlessWindowed(); /// Set window state: maximized, if resizable [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void MaximizeWindow(); /// Set window state: minimized, if resizable [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void MinimizeWindow(); /// Set window state: not minimized/maximized [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void RestoreWindow(); /// Set icon for window (single image, RGBA 32bit) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowIcon(Image image); /// Set icon for window (multiple images, RGBA 32bit) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowIcons(Image* images, int count); /// Set title for window [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowTitle(sbyte* title); /// Set window position on screen [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowPosition(int x, int y); /// Set monitor for the current window (fullscreen mode) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowMonitor(int monitor); /// Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowMinSize(int width, int height); /// Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowMaxSize(int width, int height); /// Set window dimensions [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowSize(int width, int height); /// Set window opacity [0.0f..1.0f] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowOpacity(float opacity); /// Set window focused [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetWindowFocused(); /// Get native window handle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void* GetWindowHandle(); /// Get current screen width [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetScreenWidth(); /// Get current screen height [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetScreenHeight(); /// Get current render width (it considers HiDPI) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetRenderWidth(); /// Get current render height (it considers HiDPI) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetRenderHeight(); /// Get number of connected monitors [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorCount(); /// Get current monitor where window is placed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCurrentMonitor(); /// Get specified monitor position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetMonitorPosition(int monitor); /// Get specified monitor width [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorWidth(int monitor); /// Get specified monitor height [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorHeight(int monitor); /// Get specified monitor physical width in millimetres [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorPhysicalWidth(int monitor); /// Get specified monitor physical height in millimetres [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorPhysicalHeight(int monitor); /// Get specified monitor refresh rate [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMonitorRefreshRate(int monitor); /// Get window position XY on monitor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetWindowPosition(); /// Get window scale DPI factor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetWindowScaleDPI(); /// Get the human-readable, UTF-8 encoded name of the specified monitor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetMonitorName(int monitor); /// Get clipboard text content [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetClipboardText(); /// Get clipboard image content (only works on Windows) [UnsupportedOSPlatform("browser")] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GetClipboardImage(); /// Set clipboard text content [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetClipboardText(sbyte* text); /// Enable waiting for events on EndDrawing(), no automatic event polling [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EnableEventWaiting(); /// Disable waiting for events on EndDrawing(), automatic events polling [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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() // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL /// Swap back buffer with front buffer (screen drawing) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SwapScreenBuffer(); /// Register all input events [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PollInputEvents(); /// Wait for some time (halt program execution) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void WaitTime(double seconds); // Cursor-related functions /// Shows cursor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ShowCursor(); /// Hides cursor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void HideCursor(); /// Check if cursor is not visible [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsCursorHidden(); /// Enables cursor (unlock cursor) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EnableCursor(); /// Disables cursor (lock cursor) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DisableCursor(); /// Check if cursor is on the screen [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsCursorOnScreen(); // Drawing-related functions /// Set background color (framebuffer clear color) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ClearBackground(Color color); /// Setup canvas (framebuffer) to start drawing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginDrawing(); /// End canvas drawing and swap buffers (double buffering) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndDrawing(); /// Initialize 2D mode with custom camera (2D) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginMode2D(Camera2D camera); /// Ends 2D mode with custom camera [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndMode2D(); /// Initializes 3D mode with custom camera (3D) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginMode3D(Camera3D camera); /// Ends 3D mode and returns to default 2D orthographic mode [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndMode3D(); /// Initializes render texture for drawing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginTextureMode(RenderTexture2D target); /// Ends drawing to render texture [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndTextureMode(); /// Begin custom shader drawing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginShaderMode(Shader shader); /// End custom shader drawing (use default shader) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndShaderMode(); /// Begin blending mode (alpha, additive, multiplied) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginBlendMode(BlendMode mode); /// End blending mode (reset to default: alpha blending) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndBlendMode(); /// Begin scissor mode (define screen area for following drawing) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginScissorMode(int x, int y, int width, int height); /// End scissor mode [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndScissorMode(); /// Begin stereo rendering (requires VR simulator) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void BeginVrStereoMode(VrStereoConfig config); /// End stereo rendering (requires VR simulator) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void EndVrStereoMode(); // VR stereo config functions for VR simulator /// Load VR stereo config for VR simulator device parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); /// Unload VR stereo configs [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadVrStereoConfig(VrStereoConfig config); // Shader management functions /// Load shader from files and bind default locations [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Shader LoadShader(sbyte* vsFileName, sbyte* fsFileName); /// Load shader from code strings and bind default locations [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Shader LoadShaderFromMemory(sbyte* vsCode, sbyte* fsCode); /// Check if a shader is valid (loaded on GPU) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsShaderValid(Shader shader); /// Get shader uniform location [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetShaderLocation(Shader shader, sbyte* uniformName); /// Get shader attribute location [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetShaderLocationAttrib(Shader shader, sbyte* attribName); /// Set shader uniform value [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetShaderValue( Shader shader, int locIndex, void* value, ShaderUniformDataType uniformType ); /// Set shader uniform value vector [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetShaderValueV( Shader shader, int locIndex, void* value, ShaderUniformDataType uniformType, int count ); /// Set shader uniform value (matrix 4x4) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetShaderValueMatrix(Shader shader, int locIndex, Matrix4x4 mat); /// Set shader uniform value for texture (sampler2d) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); /// Unload shader from GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadShader(Shader shader); // Screen-space-related functions /// Get a ray trace from screen position (i.e mouse) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Ray GetScreenToWorldRay(Vector2 position, Camera3D camera); /// Get a ray trace from screen position (i.e mouse) in a viewport [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Ray GetScreenToWorldRayEx(Vector2 position, Camera3D camera, int width, int height); /// Get camera transform matrix (view matrix) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Matrix4x4 GetCameraMatrix(Camera3D camera); /// Get camera 2d transform matrix [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Matrix4x4 GetCameraMatrix2D(Camera2D camera); /// Get the screen space position for a 3d world space position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetWorldToScreen(Vector3 position, Camera3D camera); /// Get size position for a 3d world space position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetWorldToScreenEx(Vector3 position, Camera3D camera, int width, int height); /// Get the screen space position for a 2d camera world space position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); /// Get the world space position for a 2d camera screen space position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Timing-related functions /// Set target FPS (maximum) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTargetFPS(int fps); /// Get current FPS [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetFPS(); /// Get time in seconds for last frame drawn [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetFrameTime(); /// Get elapsed time in seconds since InitWindow() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial double GetTime(); // Misc. functions /// Get a random value between min and max (both included) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetRandomValue(int min, int max); /// Set the seed for the random number generator [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetRandomSeed(uint seed); /// Load random values sequence, no values repeated [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int* LoadRandomSequence(uint count, int min, int max); /// Unload random values sequence [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadRandomSequence(int* sequence); // Misc. functions /// Takes a screenshot of current screen (saved a .png) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void TakeScreenshot(sbyte* fileName); /// Setup window configuration flags (view FLAGS) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetConfigFlags(ConfigFlags flags); /// Open URL with default system browser (if available) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void OpenURL(sbyte* url); // Logging system /// Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void TraceLog(TraceLogLevel logLevel, sbyte* text); /// Set the current threshold (minimum) log level [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTraceLogLevel(TraceLogLevel logLevel); // Memory management, using internal allocators /// Internal memory allocator [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void* MemAlloc(uint size); /// Internal memory reallocator [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void* MemRealloc(void* ptr, uint size); /// Internal memory free [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void MemFree(void* ptr); // Set custom callbacks // WARNING: Callbacks setup is intended for advance users /// Set custom trace log [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTraceLogCallback(delegate* unmanaged[Cdecl] callback); // Files management functions /// Load file data as byte array (read) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial byte* LoadFileData(sbyte* fileName, int* dataSize); /// Unload file data allocated by LoadFileData() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadFileData(byte* data); /// Save data to file from byte array (write), returns true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool SaveFileData(sbyte* fileName, void* data, int dataSize); /// Export data to code (.h), returns true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportDataAsCode(byte* data, int dataSize, sbyte* fileName); /// Load text data from file (read), returns a '\0' terminated string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* LoadFileText(sbyte* fileName); /// Unload file text data allocated by LoadFileText() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadFileText(sbyte* text); /// Save text data to file (write), string must be '\0' terminated, returns true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool SaveFileText(sbyte* fileName, sbyte* text); // File access custom callbacks // WARNING: Callbacks setup is intended for advanced users /// Set custom file binary data loader [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetLoadFileDataCallback(delegate* unmanaged[Cdecl] callback); /// Set custom file binary data saver [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetSaveFileDataCallback( delegate* unmanaged[Cdecl] callback ); /// Set custom file text data loader [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetLoadFileTextCallback(delegate* unmanaged[Cdecl] callback); /// Set custom file text data saver [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetSaveFileTextCallback(delegate* unmanaged[Cdecl] callback); /// Rename file (if exists) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileRename(sbyte* fileName, sbyte* fileRename); /// Remove file (if exists) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileRemove(sbyte* fileName); /// Copy file from one path to another, dstPath created if it doesn't exist [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileCopy(sbyte* srcPath, sbyte* dstPath); /// Move file from one path to another, dstPath created if it doesn't exist [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileMove(sbyte* srcPath, sbyte* dstPath); /// Replace text in an existing file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileTextReplace(sbyte* fileName, sbyte* search, sbyte* replacement); /// Find text in existing file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int FileTextFindIndex(sbyte* fileName, sbyte* search); /// Check if file exists [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool FileExists(sbyte* fileName); /// Check if a directory path exists [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool DirectoryExists(sbyte* dirPath); /// Check file extension (including point: .png, .wav) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsFileExtension(sbyte* fileName, sbyte* ext); /// Get file length in bytes [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetFileLength(sbyte* fileName); /// Get file modification time (last write time) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CLong GetFileModTime(sbyte* fileName); /// Get pointer to extension for a filename string (includes dot: '.png') [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetFileExtension(sbyte* fileName); /// Get pointer to filename for a path string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetFileName(sbyte* filePath); /// Get filename string without extension (uses static string) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetFileNameWithoutExt(sbyte* filePath); /// Get full path for a given fileName with path (uses static string) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetDirectoryPath(sbyte* filePath); /// Get previous directory path for a given path (uses static string) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetPrevDirectoryPath(sbyte* dirPath); /// Get current working directory (uses static string) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetWorkingDirectory(); /// Get the directory of the running application (uses static string) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetApplicationDirectory(); /// Create directories (including full path requested), returns 0 on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int MakeDirectory(sbyte* dirPath); /// Change working directory, return true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ChangeDirectory(sbyte* dirPath); /// Check if a given path is a file or a directory [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsPathFile(sbyte* path); /// Check if fileName is valid for the platform/OS [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsFileNameValid(sbyte* fileName); /// Load directory filepaths [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial FilePathList LoadDirectoryFiles(sbyte* dirPath); /// Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial FilePathList LoadDirectoryFilesEx(sbyte* basePath, sbyte* filter, CBool scanSubdirs); /// Unload filepaths [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadDirectoryFiles(FilePathList files); /// Check if a file has been dropped into window [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsFileDropped(); /// Load dropped filepaths [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial FilePathList LoadDroppedFiles(); /// Unload dropped filepaths [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadDroppedFiles(FilePathList files); /// Get the file count in a directory [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetDirectoryFileCount(sbyte* dirPath); /// Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetDirectoryFileCountEx(sbyte* dirPath, sbyte* filter, CBool scanSubdirs); // Compression/Encoding functionality /// Compress data (DEFLATE algorithm), memory must be MemFree() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial byte* CompressData(byte* data, int dataSize, int* compDataSize); /// Decompress data (DEFLATE algorithm), memory must be MemFree() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial byte* DecompressData(byte* compData, int compDataSize, int* dataSize); /// Encode data to Base64 string, memory must be MemFree() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* EncodeDataBase64(byte* data, int dataSize, int* outputSize); /// Decode Base64 string data, memory must be MemFree() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial byte* DecodeDataBase64(sbyte* data, int* outputSize); /// Compute CRC32 hash code [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint ComputeCRC32(byte* data, int dataSize); /// Compute MD5 hash code, returns static int[4] (16 bytes) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint* ComputeMD5(byte* data, int dataSize); /// Compute SHA1 hash code, returns static int[5] (20 bytes) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint* ComputeSHA1(byte* data, int dataSize); /// Compute SHA256 hash code, returns static int[8] (32 bytes) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint* ComputeSHA256(byte* data, int dataSize); // Automation events functionality /// Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial AutomationEventList LoadAutomationEventList(sbyte* fileName); /// Unload automation events list from file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadAutomationEventList(AutomationEventList list); /// Export automation events list as text file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportAutomationEventList(AutomationEventList list, sbyte* fileName); /// Set automation event list to record to [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAutomationEventList(AutomationEventList* list); /// Set automation event internal base frame to start recording [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAutomationEventBaseFrame(int frame); /// Start recording automation events (AutomationEventList must be set) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void StartAutomationEventRecording(); /// Stop recording automation events [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void StopAutomationEventRecording(); /// Play a recorded automation event [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PlayAutomationEvent(AutomationEvent ev); //------------------------------------------------------------------------------------ // Input Handling Functions (Module: core) //------------------------------------------------------------------------------------ // Input-related functions: keyboard /// Detect if a key has been pressed once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsKeyPressed(KeyboardKey key); /// Detect if a key has been pressed again [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsKeyPressedRepeat(KeyboardKey key); /// Detect if a key is being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsKeyDown(KeyboardKey key); /// Detect if a key has been released once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsKeyReleased(KeyboardKey key); /// Detect if a key is NOT being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsKeyUp(KeyboardKey key); /// /// Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetKeyPressed(); /// /// Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCharPressed(); /// Get gamepad internal name id [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetKeyName(KeyboardKey key); /// Set a custom key to exit program (default is ESC) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetExitKey(KeyboardKey key); // Input-related functions: gamepads /// Detect if a gamepad is available [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGamepadAvailable(int gamepad); /// Get gamepad internal name id [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetGamepadName(int gamepad); /// Detect if a gamepad button has been pressed once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGamepadButtonPressed(int gamepad, GamepadButton button); /// Detect if a gamepad button is being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGamepadButtonDown(int gamepad, GamepadButton button); /// Detect if a gamepad button has been released once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGamepadButtonReleased(int gamepad, GamepadButton button); /// Detect if a gamepad button is NOT being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGamepadButtonUp(int gamepad, GamepadButton button); /// Get the last gamepad button pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetGamepadButtonPressed(); /// Get gamepad axis count for a gamepad [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetGamepadAxisCount(int gamepad); /// Get axis movement value for a gamepad axis [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetGamepadAxisMovement(int gamepad, GamepadAxis axis); /// Set internal gamepad mappings (SDL_GameControllerDB) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int SetGamepadMappings(sbyte* mappings); /// Set gamepad vibration for both motors (duration in seconds) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Input-related functions: mouse /// Detect if a mouse button has been pressed once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMouseButtonPressed(MouseButton button); /// Detect if a mouse button is being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMouseButtonDown(MouseButton button); /// Detect if a mouse button has been released once [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMouseButtonReleased(MouseButton button); /// Detect if a mouse button is NOT being pressed [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMouseButtonUp(MouseButton button); /// Get mouse position X [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMouseX(); /// Get mouse position Y [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetMouseY(); /// Get mouse position XY [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetMousePosition(); /// Get mouse delta between frames [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetMouseDelta(); /// Set mouse position XY [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMousePosition(int x, int y); /// Set mouse offset [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMouseOffset(int offsetX, int offsetY); /// Set mouse scaling [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMouseScale(float scaleX, float scaleY); /// Get mouse wheel movement for X or Y, whichever is larger [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetMouseWheelMove(); /// Get mouse wheel movement for both X and Y [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetMouseWheelMoveV(); /// Set mouse cursor [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMouseCursor(MouseCursor cursor); // Input-related functions: touch /// Get touch position X for touch point 0 (relative to screen size) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetTouchX(); /// Get touch position Y for touch point 0 (relative to screen size) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetTouchY(); /// Get touch position XY for a touch point index (relative to screen size) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetTouchPosition(int index); /// Get touch point identifier for given index [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetTouchPointId(int index); /// Get number of touch points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetTouchPointCount(); //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ /// Enable a set of gestures using flags [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetGesturesEnabled(Gesture flags); /// Check if a gesture has been detected [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsGestureDetected(Gesture gesture); /// Get latest detected gesture [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Gesture GetGestureDetected(); /// Get gesture hold time in seconds [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetGestureHoldDuration(); /// Get gesture drag vector [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetGestureDragVector(); /// Get gesture drag angle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetGestureDragAngle(); /// Get gesture pinch delta [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetGesturePinchVector(); /// Get gesture pinch angle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetGesturePinchAngle(); //------------------------------------------------------------------------------------ // Camera System Functions (Module: camera) //------------------------------------------------------------------------------------ /// Update camera position for selected mode [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateCamera(Camera3D* camera, CameraMode mode); /// Update camera movement/rotation [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateCameraPro(Camera3D* camera, Vector3 movement, Vector3 rotation, float zoom); /// Returns the cameras forward vector (normalized) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector3 GetCameraForward(Camera3D* camera); /// /// Returns the cameras up vector (normalized)
/// NOTE: The up vector might not be perpendicular to the forward vector ///
[LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector3 GetCameraUp(Camera3D* camera); /// Returns the cameras right vector (normalized) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector3 GetCameraRight(Camera3D* camera); // Camera movement /// Moves the camera in its forward direction [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraMoveForward(Camera3D* camera, float distance, CBool moveInWorldPlane); /// Moves the camera in its up direction [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraMoveUp(Camera3D* camera, float distance); /// Moves the camera target in its current right direction [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraMoveRight(Camera3D* camera, float distance, CBool moveInWorldPlane); /// Moves the camera position closer/farther to/from the camera target [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraMoveToTarget(Camera3D* camera, float delta); // Camera rotation /// /// Rotates the camera around its up vector
/// If rotateAroundTarget is false, the camera rotates around its position ///
[LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraYaw(Camera3D* camera, float angle, CBool rotateAroundTarget); /// /// Rotates the camera around its right vector /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraPitch( Camera3D* camera, float angle, CBool lockView, CBool rotateAroundTarget, CBool rotateUp ); /// Rotates the camera around its forward vector [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CameraRoll(Camera3D* camera, float angle); /// Returns the camera view matrix [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Matrix4x4 GetCameraViewMatrix(Camera3D* camera); /// Returns the camera projection matrix [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Matrix4x4 GetCameraProjectionMatrix(Camera3D* camera, float aspect); //------------------------------------------------------------------------------------ // Basic Shapes Drawing Functions (Module: shapes) //------------------------------------------------------------------------------------ /// /// Set texture and rectangle to be used on shapes drawing
/// NOTE: It can be useful when using basic shapes and one single font.
/// Defining a white rectangle would allow drawing everything in a single draw call. ///
[LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetShapesTexture(Texture2D texture, Rectangle source); /// Get texture that is used for shapes drawing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Texture2D GetShapesTexture(); /// Get texture source rectangle that is used for shapes drawing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Rectangle GetShapesTextureRectangle(); // Basic shapes drawing functions /// Draw a pixel using geometry [Can be slow, use with care] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPixel(int posX, int posY, Color color); /// Draw a pixel using geometry (Vector version) [Can be slow, use with care] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPixelV(Vector2 position, Color color); /// Draw a line [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); /// Draw a line (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); /// Draw a line defining thickness [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); /// Draw lines sequence [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineStrip(Vector2* points, int pointCount, Color color); /// Draw a line using cubic-bezier curves in-out [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); /// Draw a dashed line [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); /// Draw a color-filled circle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircle(int centerX, int centerY, float radius, Color color); /// Draw a color-filled circle (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleV(Vector2 center, float radius, Color color); /// Draw a gradient-filled circle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleGradient( Vector2 center, float radius, Color inner, Color outer ); /// Draw a piece of a circle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color ); /// Draw circle sector outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color ); /// Draw circle outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleLines(int centerX, int centerY, float radius, Color color); /// Draw circle outline (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircleLinesV(Vector2 center, float radius, Color color); /// Draw ellipse [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); /// Draw ellipse (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); /// Draw ellipse outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); /// Draw ellipse outline (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); /// Draw ring [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color ); /// Draw ring outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color ); /// Draw a color-filled rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangle(int posX, int posY, int width, int height, Color color); /// Draw a color-filled rectangle (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleV(Vector2 position, Vector2 size, Color color); /// Draw a color-filled rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleRec(Rectangle rec, Color color); /// Draw a color-filled rectangle with pro parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); /// Draw a vertical-gradient-filled rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleGradientV( int posX, int posY, int width, int height, Color top, Color bottom ); /// Draw a horizontal-gradient-filled rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleGradientH( int posX, int posY, int width, int height, Color left, Color right ); /// Draw a gradient-filled rectangle with custom vertex colors [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleGradientEx( Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight ); /// Draw rectangle outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleLines(int posX, int posY, int width, int height, Color color); /// Draw rectangle outline with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); /// Draw rectangle with rounded edges [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); /// Draw rectangle lines with rounded edges [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, Color color ); /// Draw rectangle with rounded edges outline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRectangleRoundedLinesEx( Rectangle rec, float roundness, int segments, float lineThick, Color color ); /// Draw a color-filled triangle (vertex in counter-clockwise order!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// Draw triangle outline (vertex in counter-clockwise order!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// Draw a triangle fan defined by points (first vertex is the center) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangleFan(Vector2* points, int pointCount, Color color); /// Draw a triangle strip defined by points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangleStrip(Vector2* points, int pointCount, Color color); /// Draw a regular polygon (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); /// Draw a polygon outline of n sides [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); /// Draw a polygon outline of n sides with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color ); // Splines drawing functions /// Draw spline: Linear, minimum 2 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineLinear(Vector2* points, int pointCount, float thick, Color color); /// Draw spline: B-Spline, minimum 4 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineBasis(Vector2* points, int pointCount, float thick, Color color); /// Draw spline: Catmull-Rom, minimum 4 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineCatmullRom(Vector2* points, int pointCount, float thick, Color color); /// Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineBezierQuadratic(Vector2* points, int pointCount, float thick, Color color); /// Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineBezierCubic(Vector2* points, int pointCount, float thick, Color color); /// Draw spline segment: Linear, 2 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); /// Draw spline segment: B-Spline, 4 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); /// Draw spline segment: Catmull-Rom, 4 points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); /// Draw spline segment: Quadratic Bezier, 2 points, 1 control point [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); /// Draw spline segment: Cubic Bezier, 2 points, 2 control points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); // Spline segment point evaluation functions, for a given t [0.0f .. 1.0f] /// Get (evaluate) spline point: Linear [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetSplinePointLinear(Vector2 startPos, Vector2 endPos, float t); /// Get (evaluate) spline point: B-Spline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetSplinePointBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); /// Get (evaluate) spline point: Catmull-Rom [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetSplinePointCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); /// Get (evaluate) spline point: Quadratic Bezier [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetSplinePointBezierQuad(Vector2 p1, Vector2 c2, Vector2 p3, float t); /// Get (evaluate) spline point: Cubic Bezier [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 GetSplinePointBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float t); // Basic shapes collision detection functions /// Check collision between two rectangles [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); /// Check collision between two circles [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionCircles( Vector2 center1, float radius1, Vector2 center2, float radius2 ); /// Check collision between circle and rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); /// Check if circle collides with a line created betweeen two points [p1] and [p2] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); /// Check if point is inside rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionPointRec(Vector2 point, Rectangle rec); /// Check if point is inside circle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); /// Check if point is inside a triangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); /// Check if point is within a polygon described by array of vertices [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionPointPoly(Vector2 point, Vector2* points, int pointCount); /// /// Check the collision between two lines defined by two points each, returns collision point by reference /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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] /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); /// Get collision rectangle for two rectangles collision [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); //------------------------------------------------------------------------------------ // Texture Loading and Drawing Functions (Module: textures) //------------------------------------------------------------------------------------ // Image loading functions // NOTE: This functions do not require GPU access /// Load image from file into CPU memory (RAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImage(sbyte* fileName); /// Load image from RAW file data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageRaw( sbyte* fileName, int width, int height, PixelFormat format, int headerSize ); /// Load image sequence from file (frames appended to image.data) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageAnim(sbyte* fileName, int* frames); /// Load image sequence from memory buffer [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageAnimFromMemory(sbyte* fileType, byte* fileData, int dataSize, int* frames); /// Load image from memory buffer, fileType refers to extension: i.e. ".png" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageFromMemory(sbyte* fileType, byte* fileData, int dataSize); /// Load image from GPU texture data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageFromTexture(Texture2D texture); /// Load image from screen buffer and (screenshot) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image LoadImageFromScreen(); /// Check if an image is valid (data and parameters) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsImageValid(Image image); /// Unload image from CPU memory (RAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadImage(Image image); /// Export image data to file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportImage(Image image, sbyte* fileName); /// Export image to memory buffer [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial byte* ExportImageToMemory(Image image, sbyte* fileType, int* fileSize); /// Export image as code file defining an array of bytes [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportImageAsCode(Image image, sbyte* fileName); // Image generation functions /// Generate image: plain color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageColor(int width, int height, Color color); /// Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); /// Generate image: radial gradient [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageGradientRadial( int width, int height, float density, Color inner, Color outer ); /// Generate image: square gradient [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageGradientSquare( int width, int height, float density, Color inner, Color outer); /// Generate image: checked [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageChecked( int width, int height, int checksX, int checksY, Color col1, Color col2 ); /// Generate image: white noise [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageWhiteNoise(int width, int height, float factor); /// Generate image: perlin noise [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); /// Generate image: cellular algorithm, bigger tileSize means bigger cells [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageCellular(int width, int height, int tileSize); /// Generate image: grayscale image from text data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageText(int width, int height, sbyte* text); // Image manipulation functions /// Create an image duplicate (useful for transformations) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image ImageCopy(Image image); /// Create an image from another image piece [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image ImageFromImage(Image image, Rectangle rec); /// Create an image from a selected channel of another image (GRAYSCALE) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image ImageFromChannel(Image image, int selectedChannel); /// Create an image from text (default font) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image ImageText(sbyte* text, int fontSize, Color color); /// Create an image from text (custom sprite font) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image ImageTextEx(Font font, sbyte* text, float fontSize, float spacing, Color tint); /// Convert image data to desired format [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageFormat(Image* image, PixelFormat newFormat); /// Convert image to POT (power-of-two) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageToPOT(Image* image, Color fill); /// Crop an image to a defined rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageCrop(Image* image, Rectangle crop); /// Crop image depending on alpha value [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageAlphaCrop(Image* image, float threshold); /// Clear alpha channel to desired color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageAlphaClear(Image* image, Color color, float threshold); /// Apply alpha mask to image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageAlphaMask(Image* image, Image alphaMask); /// Premultiply alpha channel [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageAlphaPremultiply(Image* image); /// Apply Gaussian blur using a box blur approximation [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageBlurGaussian(Image* image, int blurSize); /// Apply custom square convolution kernel to image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageKernelConvolution(Image* image, float* kernel, int kernelSize); /// Resize image (Bicubic scaling algorithm) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageResize(Image* image, int newWidth, int newHeight); /// Resize image (Nearest-Neighbor scaling algorithm) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageResizeNN(Image* image, int newWidth, int newHeight); /// Resize canvas and fill with color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageResizeCanvas( Image* image, int newWidth, int newHeight, int offsetX, int offsetY, Color color ); /// Generate all mipmap levels for a provided image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageMipmaps(Image* image); /// Dither image data to 16bpp or lower (Floyd-Steinberg dithering) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDither(Image* image, int rBpp, int gBpp, int bBpp, int aBpp); /// Flip image vertically [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageFlipVertical(Image* image); /// Flip image horizontally [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageFlipHorizontal(Image* image); /// Rotate image by input angle in degrees (-359 to 359) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageRotate(Image* image, int degrees); /// Rotate image clockwise 90deg [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageRotateCW(Image* image); /// Rotate image counter-clockwise 90deg [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageRotateCCW(Image* image); /// Modify image color: tint [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorTint(Image* image, Color color); /// Modify image color: invert [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorInvert(Image* image); /// Modify image color: grayscale [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorGrayscale(Image* image); /// Modify image color: contrast (-100 to 100) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorContrast(Image* image, float contrast); /// Modify image color: brightness (-255 to 255) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorBrightness(Image* image, int brightness); /// Modify image color: replace color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageColorReplace(Image* image, Color color, Color replace); /// Load color data from image as a Color array (RGBA - 32bit) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color* LoadImageColors(Image image); /// Load colors palette from image as a Color array (RGBA - 32bit) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color* LoadImagePalette(Image image, int maxPaletteSize, int* colorCount); /// Unload color data loaded with LoadImageColors() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadImageColors(Color* colors); /// Unload colors palette loaded with LoadImagePalette() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadImagePalette(Color* colors); /// Get image alpha border rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Rectangle GetImageAlphaBorder(Image image, float threshold); /// Get image pixel color at (x, y) position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color GetImageColor(Image image, int x, int y); // Image drawing functions // NOTE: Image software-rendering functions (CPU) /// Clear image background with given color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageClearBackground(Image* dst, Color color); /// Draw pixel within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawPixel(Image* dst, int posX, int posY, Color color); /// Draw pixel within an image (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawPixelV(Image* dst, Vector2 position, Color color); /// Draw line within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawLine( Image* dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color ); /// Draw line within an image (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawLineV(Image* dst, Vector2 start, Vector2 end, Color color); /// Draw a line defining thickness within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawLineEx(Image* dst, Vector2 start, Vector2 end, int thick, Color color); /// Draw circle within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color); /// Draw circle within an image (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawCircleV(Image* dst, Vector2 center, int radius, Color color); /// Draw circle outline within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawCircleLines(Image* dst, int centerX, int centerY, int radius, Color color); /// Draw circle outline within an image (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawCircleLinesV(Image* dst, Vector2 center, int radius, Color color); /// Draw rectangle within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawRectangle( Image* dst, int posX, int posY, int width, int height, Color color ); /// Draw rectangle within an image (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawRectangleV(Image* dst, Vector2 position, Vector2 size, Color color); /// Draw rectangle within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawRectangleRec(Image* dst, Rectangle rec, Color color); /// Draw rectangle lines within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawRectangleLines(Image* dst, Rectangle rec, int thick, Color color); /// Draw triangle within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTriangle(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// Draw triangle with interpolated colors within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTriangleEx(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); /// Draw triangle outline within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTriangleLines(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// Draw a triangle fan defined by points within an image (first vertex is the center) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTriangleFan(Image* dst, Vector2* points, int pointCount, Color color); /// Draw a triangle strip defined by points within an image [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTriangleStrip(Image* dst, Vector2* points, int pointCount, Color color); /// Draw a source image within a destination image (tint applied to source) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDraw(Image* dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); /// Draw text (using default font) within an image (destination) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawText(Image* dst, sbyte* text, int x, int y, int fontSize, Color color); /// Draw text (custom sprite font) within an image (destination) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ImageDrawTextEx( Image* dst, Font font, sbyte* text, Vector2 position, float fontSize, float spacing, Color tint ); // Texture loading functions // NOTE: These functions require GPU access /// Load texture from file into GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Texture2D LoadTexture(sbyte* fileName); /// Load texture from image data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Texture2D LoadTextureFromImage(Image image); /// Load cubemap from image, multiple image cubemap layouts supported [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Texture2D LoadTextureCubemap(Image image, CubemapLayout layout); /// Load texture for rendering (framebuffer) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RenderTexture2D LoadRenderTexture(int width, int height); /// Check if a texture is valid (loaded in GPU) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsTextureValid(Texture2D texture); /// Unload texture from GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadTexture(Texture2D texture); /// Check if a render texture is valid (loaded in GPU) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsRenderTextureValid(RenderTexture2D target); /// Unload render texture from GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadRenderTexture(RenderTexture2D target); /// Update GPU texture with new data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateTexture(Texture2D texture, void* pixels); /// Update GPU texture rectangle with new data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateTextureRec(Texture2D texture, Rectangle rec, void* pixels); // Texture configuration functions /// Generate GPU mipmaps for a texture [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void GenTextureMipmaps(Texture2D* texture); /// Set texture scaling filter mode [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTextureFilter(Texture2D texture, TextureFilter filter); /// Set texture wrapping mode [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTextureWrap(Texture2D texture, TextureWrap wrap); // Texture drawing functions /// Draw a Texture2D [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTexture(Texture2D texture, int posX, int posY, Color tint); /// Draw a Texture2D with position defined as Vector2 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextureV(Texture2D texture, Vector2 position, Color tint); /// Draw a Texture2D with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextureEx( Texture2D texture, Vector2 position, float rotation, float scale, Color tint ); /// Draw a part of a texture defined by a rectangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); /// Draw a part of a texture defined by a rectangle with 'pro' parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextureNPatch( Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ); // Color/pixel related functions /// Check if two colors are equal [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ColorIsEqual(Color col1, Color col2); /// Get hexadecimal value for a Color (0xRRGGBBAA) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int ColorToInt(Color color); /// Get color normalized as float [0..1] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector4 ColorNormalize(Color color); /// Get color from normalized values [0..1] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorFromNormalized(Vector4 normalized); /// Get HSV values for a Color, hue [0..360], saturation/value [0..1] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector3 ColorToHSV(Color color); /// Get a Color from HSV values, hue [0..360], saturation/value [0..1] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorFromHSV(float hue, float saturation, float value); /// Get color multiplied with another color [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorTint(Color color, Color tint); /// Get color with brightness correction, brightness factor goes from -1.0f to 1.0f [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorBrightness(Color color, float factor); /// Get color with contrast correction, contrast values between -1.0f and 1.0f [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorContrast(Color color, float contrast); /// Get color with alpha applied, alpha goes from 0.0f to 1.0f [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorAlpha(Color color, float alpha); /// Get src alpha-blended into dst color with tint [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorAlphaBlend(Color dst, Color src, Color tint); /// Get color lerp interpolation between two colors, factor [0.0f..1.0f] [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color ColorLerp(Color color1, Color color2, float factor); /// Get Color structure from hexadecimal value [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color GetColor(uint hexValue); /// Get Color from a source pixel pointer of certain format [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Color GetPixelColor(void* srcPtr, PixelFormat format); /// Set color formatted into destination pixel pointer [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetPixelColor(void* dstPtr, Color color, PixelFormat format); /// Get pixel data size in bytes for certain format [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetPixelDataSize(int width, int height, PixelFormat format); //------------------------------------------------------------------------------------ // Font Loading and Text Drawing Functions (Module: text) //------------------------------------------------------------------------------------ // Font loading/unloading functions /// Get the default Font [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Font GetFontDefault(); /// Load font from file into GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Font LoadFont(sbyte* fileName); /// /// Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load /// the default character set, font size is provided in pixels height /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Font LoadFontEx(sbyte* fileName, int fontSize, int* codepoints, int codepointCount); /// Load font from Image (XNA style) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Font LoadFontFromImage(Image image, Color key, int firstChar); /// Load font from memory buffer, fileType refers to extension: i.e. ".ttf" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Font LoadFontFromMemory( sbyte* fileType, byte* fileData, int dataSize, int fontSize, int* codepoints, int codepointCount ); /// Check if a font is valid (font data loaded, WARNING: GPU texture not checked) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsFontValid(Font font); /// Load font data for further use [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial GlyphInfo* LoadFontData( byte* fileData, int dataSize, int fontSize, int* fontChars, int glyphCount, FontType type ); /// Generate image font atlas using chars info [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Image GenImageFontAtlas( GlyphInfo* chars, Rectangle** recs, int glyphCount, int fontSize, int padding, int packMethod ); /// Unload font chars info data (RAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadFontData(GlyphInfo* chars, int glyphCount); /// Unload Font from GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadFont(Font font); /// Export font as code file, returns true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportFontAsCode(Font font, sbyte* fileName); // Text drawing functions /// Shows current FPS [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawFPS(int posX, int posY); /// Draw text (using default font) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawText(sbyte* text, int posX, int posY, int fontSize, Color color); /// Draw text using font and additional parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextEx( Font font, sbyte* text, Vector2 position, float fontSize, float spacing, Color tint ); /// Draw text using Font and pro parameters (rotation) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextPro( Font font, sbyte* text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint ); /// Draw one character (codepoint) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextCodepoint( Font font, int codepoint, Vector2 position, float fontSize, Color tint ); /// Draw multiple characters (codepoint) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTextCodepoints( Font font, int* codepoints, int count, Vector2 position, float fontSize, float spacing, Color tint ); // Text font info functions /// Set vertical line spacing when drawing with line-breaks [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetTextLineSpacing(int spacing); /// Measure string width for default font [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int MeasureText(sbyte* text, int fontSize); /// Measure string size for Font [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 MeasureTextEx(Font font, sbyte* text, float fontSize, float spacing); /// Measure string size for Font [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Vector2 MeasureTextCodepoints(Font font, int* codepoints, int length, float fontSize, float spacing); /// /// Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetGlyphIndex(Font font, int character); /// /// Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial GlyphInfo GetGlyphInfo(Font font, int codepoint); /// /// Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found /// [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Text codepoints management functions (unicode characters) /// Load UTF-8 text encoded from codepoints array [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* LoadUTF8(int* codepoints, int length); /// Unload UTF-8 text encoded from codepoints array [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadUTF8(sbyte* text); /// Load all codepoints from a UTF-8 text string, codepoints count returned by parameter [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int* LoadCodepoints(sbyte* text, int* count); /// Unload codepoints data from memory [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadCodepoints(int* codepoints); /// Get total number of codepoints in a UTF8 encoded string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCodepointCount(sbyte* text); /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCodepoint(sbyte* text, int* codepointSize); /// Get next codepoint in a UTF-8 encoded string; 0x3f('?') is returned on failure [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCodepointNext(sbyte* text, int* codepointSize); /// Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int GetCodepointPrevious(sbyte* text, int* codepointSize); /// Encode one codepoint into UTF-8 byte array (array length returned as parameter) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* CodepointToUTF8(int codepoint, int* utf8Size); // Text strings management functions (no UTF-8 strings, only byte chars) // WARNING 1: Most of these functions use internal static buffers[], it's recommended to store returned data on user-side for re-use // WARNING 2: Some functions allocate memory internally for the returned strings, those strings must be freed by user using MemFree() // NOTE: Some strings allocate memory internally for returned strings, just be careful! /// Load text as separate lines ('\n') [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte** LoadTextLines(sbyte* text, int* count); /// Unload text lines [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadTextLines(sbyte** text, int* lineCount); /// Copy one string to another, returns bytes copied [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int TextCopy(sbyte* dst, sbyte* src); /// Check if two text string are equal [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool TextIsEqual(sbyte* text1, sbyte* text2); /// Get text length, checks for '\0' ending [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial uint TextLength(sbyte* text); /// Text formatting with variables (sprintf style) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextFormat(sbyte* text); /// Get a piece of a text string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextSubtext(sbyte* text, int position, int length); /// Remove text spaces, concat words [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextRemoveSpaces(sbyte* text); /// Get text between two strings [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* GetTextBetween(sbyte* text, sbyte* begin, sbyte* end); /// Replace text string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextReplace(sbyte* text, sbyte* search, sbyte* replacement); /// Replace text string (WARNING: memory must be freed!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextReplaceAlloc(sbyte* text, sbyte* search, sbyte* replacement); /// Replace text between two specific strings [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextReplaceBetween(sbyte* text, sbyte* start, sbyte* end, sbyte* replacement); /// Replace text between two specific strings, (WARNING: memory must be freed!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextReplaceBetweenAlloc(sbyte* text, sbyte* start, sbyte* end, sbyte* replacement); /// Insert text in a position [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextInsert(sbyte* text, sbyte* insert, int position); /// Insert text in a position (WARNING: memory must be freed!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextInsertAlloc(sbyte* text, sbyte* insert, int position); /// Join text strings with delimiter [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextJoin(sbyte** textList, int count, sbyte* delimiter); /// Split text into multiple strings [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte** TextSplit(sbyte* text, char delimiter, int* count); /// Append text at specific position and move cursor! [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void TextAppend(sbyte* text, sbyte* append, int* position); /// Find first text occurrence within a string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int TextFindIndex(sbyte* text, sbyte* find); /// Get upper case version of provided string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextToUpper(sbyte* text); /// Get lower case version of provided string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextToLower(sbyte* text); /// Get Pascal case notation version of provided string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextToPascal(sbyte* text); /// Get Snake case notation version of provided string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextToSnake(sbyte* text); /// Get Camel case notation version of provided string [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial sbyte* TextToCamel(sbyte* text); /// Get integer value from text (negative values not supported) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial int TextToInteger(sbyte* text); /// Get float value from text (negative values not supported) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float TextToFloat(sbyte* text); //------------------------------------------------------------------------------------ // Basic 3d Shapes Drawing Functions (Module: models) //------------------------------------------------------------------------------------ // Basic geometric 3D shapes drawing functions /// Draw a line in 3D world space [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); /// Draw a point in 3D space, actually a small line [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPoint3D(Vector3 position, Color color); /// Draw a circle in 3D world space [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCircle3D( Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color ); /// Draw a color-filled triangle (vertex in counter-clockwise order!) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); /// Draw a triangle strip defined by points [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawTriangleStrip3D(Vector3* points, int pointCount, Color color); /// Draw cube [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCube(Vector3 position, float width, float height, float length, Color color); /// Draw cube (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCubeV(Vector3 position, Vector3 size, Color color); /// Draw cube wires [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); /// Draw cube wires (Vector version) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); /// Draw sphere [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSphere(Vector3 centerPos, float radius, Color color); /// Draw sphere with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); /// Draw sphere wires [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); /// Draw a cylinder/cone [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCylinderEx( Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color ); /// Draw a cylinder/cone wires [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawCapsuleWires( Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color ); /// Draw a plane XZ [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawPlane(Vector3 centerPos, Vector2 size, Color color); /// Draw a ray line [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawRay(Ray ray, Color color); /// Draw a grid (centered at (0, 0, 0)) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawGrid(int slices, float spacing); //------------------------------------------------------------------------------------ // Model 3d Loading and Drawing Functions (Module: models) //------------------------------------------------------------------------------------ // Model management functions /// Load model from files (meshes and materials) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Model LoadModel(sbyte* fileName); /// Load model from generated mesh (default material) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Model LoadModelFromMesh(Mesh mesh); /// Check if a model is valid (loaded in GPU, VAO/VBOs) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsModelValid(Model model); /// Unload model from memory (RAM and/or VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadModel(Model model); /// Compute model bounding box limits (considers all meshes) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial BoundingBox GetModelBoundingBox(Model model); // Model drawing functions /// Draw a model (with texture if set) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawModel(Model model, Vector3 position, float scale, Color tint); /// Draw a model with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawModelEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint ); /// Draw a model wires (with texture if set) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawModelWires(Model model, Vector3 position, float scale, Color tint); /// Draw a model wires (with texture if set) with extended parameters [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawModelWiresEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint ); /// Draw bounding box (wires) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawBoundingBox(BoundingBox box, Color color); /// Draw a billboard texture [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawBillboard( Camera3D camera, Texture2D texture, Vector3 center, float scale, Color tint ); /// Draw a billboard texture defined by source [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawBillboardRec( Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint ); /// Draw a billboard texture defined by source and rotation [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial 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 [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UploadMesh(Mesh* mesh, CBool dynamic); /// Update mesh vertex data in GPU for a specific buffer index [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateMeshBuffer(Mesh mesh, int index, void* data, int dataSize, int offset); /// Unload mesh from memory (RAM and/or VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadMesh(Mesh mesh); /// Draw a 3d mesh with material and transform [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawMesh(Mesh mesh, Material material, Matrix4x4 transform); /// Draw multiple mesh instances with material and different transforms [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DrawMeshInstanced(Mesh mesh, Material material, Matrix4x4* transforms, int instances); /// Compute mesh bounding box limits [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial BoundingBox GetMeshBoundingBox(Mesh mesh); /// Compute mesh tangents [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void GenMeshTangents(Mesh* mesh); /// Export mesh data to file, returns true on success [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportMesh(Mesh mesh, sbyte* fileName); /// Export mesh as code file (.h) defining multiple arrays of vertex attributes [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportMeshAsCode(Mesh mesh, sbyte* fileName); // Mesh generation functions /// Generate polygonal mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshPoly(int sides, float radius); /// Generate plane mesh (with subdivisions) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshPlane(float width, float length, int resX, int resZ); /// Generate cuboid mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshCube(float width, float height, float length); /// Generate sphere mesh (standard sphere) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshSphere(float radius, int rings, int slices); /// Generate half-sphere mesh (no bottom cap) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshHemiSphere(float radius, int rings, int slices); /// Generate cylinder mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshCylinder(float radius, float height, int slices); /// Generate cone/pyramid mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshCone(float radius, float height, int slices); /// Generate torus mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); /// Generate trefoil knot mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); /// Generate heightmap mesh from image data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshHeightmap(Image heightmap, Vector3 size); /// Generate cubes-based map mesh from image data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Material loading/unloading functions //TODO: safe Helper method /// Load materials from model file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Material* LoadMaterials(sbyte* fileName, int* materialCount); /// Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Material LoadMaterialDefault(); /// Check if a material is valid (shader assigned, map textures loaded in GPU) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMaterialValid(Material material); /// Unload material from GPU memory (VRAM) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadMaterial(Material material); /// Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMaterialTexture(Material* material, MaterialMapIndex mapType, Texture2D texture); /// Set material for a mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetModelMeshMaterial(Model* model, int meshId, int materialId); // Model animations loading/unloading functions /// Load model animations from file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial ModelAnimation* LoadModelAnimations(sbyte* fileName, int* animCount); /// Update model animation pose (vertex buffers and bone matrices) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateModelAnimation(Model model, ModelAnimation anim, float frame); /// // Update model animation pose, blending two animations [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateModelAnimationEx(Model model, ModelAnimation anim, float frame, ModelAnimation animB, float frameB, float blend); /// Unload animation array data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadModelAnimations(ModelAnimation* animations, int animCount); /// Check model animation skeleton match [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsModelAnimationValid(Model model, ModelAnimation anim); // Collision detection functions /// Detect collision between two spheres [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionSpheres( Vector3 center1, float radius1, Vector3 center2, float radius2 ); /// Detect collision between two bounding boxes [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); /// Detect collision between box and sphere [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); /// Detect collision between ray and sphere [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); /// Detect collision between ray and box [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); /// Get collision info between ray and mesh [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix4x4 transform); /// Get collision info between ray and triangle [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); /// Get collision info between ray and quad [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) //------------------------------------------------------------------------------------ // Audio device management functions /// Initialize audio device and context [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void InitAudioDevice(); /// Close the audio device and context [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void CloseAudioDevice(); /// Check if audio device has been initialized successfully [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsAudioDeviceReady(); /// Set master volume (listener) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMasterVolume(float volume); /// Get master volume (listener) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetMasterVolume(); // Wave/Sound loading/unloading functions /// Load wave data from file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Wave LoadWave(sbyte* fileName); /// Load wave from memory buffer, fileType refers to extension: i.e. ".wav" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Wave LoadWaveFromMemory(sbyte* fileType, byte* fileData, int dataSize); /// Checks if wave data is valid (data loaded and parameters) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsWaveValid(Wave wave); /// Load sound from file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Sound LoadSound(sbyte* fileName); /// Load sound from wave data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Sound LoadSoundFromWave(Wave wave); /// Create a new sound that shares the same sample data as the source sound, does not own the sound data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Sound LoadSoundAlias(Sound source); /// Checks if a sound is valid (data loaded and buffers initialized) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsSoundValid(Sound sound); /// Update sound buffer with new data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateSound(Sound sound, void* data, int sampleCount); /// Unload wave data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadWave(Wave wave); /// Unload sound [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadSound(Sound sound); /// Unload a sound alias (does not deallocate sample data) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadSoundAlias(Sound alias); /// Export wave data to file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportWave(Wave wave, sbyte* fileName); /// Export wave sample data to code (.h) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool ExportWaveAsCode(Wave wave, sbyte* fileName); // Wave/Sound management functions /// Play a sound [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PlaySound(Sound sound); /// Stop playing a sound [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void StopSound(Sound sound); /// Pause a sound [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PauseSound(Sound sound); /// Resume a paused sound [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ResumeSound(Sound sound); /// Check if a sound is currently playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsSoundPlaying(Sound sound); /// Set volume for a sound (1.0 is max level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetSoundVolume(Sound sound, float volume); /// Set pitch for a sound (1.0 is base level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetSoundPitch(Sound sound, float pitch); /// Set pan for a sound (-1.0 left, 0.0 center, 1.0 right) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetSoundPan(Sound sound, float pan); /// Copy a wave to a new wave [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Wave WaveCopy(Wave wave); /// Crop a wave to defined frames range [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void WaveCrop(Wave* wave, int initFrame, int finalFrame); /// Convert wave data to desired format [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void WaveFormat(Wave* wave, int sampleRate, int sampleSize, int channels); /// Get samples data from wave as a floats array [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float* LoadWaveSamples(Wave wave); /// Unload samples data loaded with LoadWaveSamples() [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadWaveSamples(float* samples); // Music management functions /// Load music stream from file [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Music LoadMusicStream(sbyte* fileName); /// Load music stream from memory buffer, fileType refers to extension: i.e. ".wav" [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial Music LoadMusicStreamFromMemory(sbyte* fileType, byte* data, int dataSize); /// Checks if a music stream is valid (context and buffers initialized) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMusicValid(Music music); /// Unload music stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadMusicStream(Music music); /// Start music playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PlayMusicStream(Music music); /// Check if music is playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsMusicStreamPlaying(Music music); /// Updates buffers for music streaming [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateMusicStream(Music music); /// Stop music playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void StopMusicStream(Music music); /// Pause music playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PauseMusicStream(Music music); /// Resume playing paused music [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ResumeMusicStream(Music music); /// Seek music to a position (in seconds) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SeekMusicStream(Music music, float position); /// Set volume for music (1.0 is max level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMusicVolume(Music music, float volume); /// Set pitch for a music (1.0 is base level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMusicPitch(Music music, float pitch); /// Set pan for a music (-1.0 left, 0.0 center, 1.0 right) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetMusicPan(Music music, float pan); /// Get music time length (in seconds) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetMusicTimeLength(Music music); /// Get current music time played (in seconds) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial float GetMusicTimePlayed(Music music); // AudioStream management functions /// Init audio stream (to stream raw audio pcm data) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial AudioStream LoadAudioStream(uint sampleRate, uint sampleSize, uint channels); /// Checks if an audio stream is valid (buffers initialized) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsAudioStreamValid(AudioStream stream); /// Unload audio stream and free memory [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UnloadAudioStream(AudioStream stream); /// Update audio stream buffers with data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void UpdateAudioStream(AudioStream stream, void* data, int frameCount); /// Check if any audio stream buffers requires refill [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsAudioStreamProcessed(AudioStream stream); /// Play audio stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PlayAudioStream(AudioStream stream); /// Pause audio stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void PauseAudioStream(AudioStream stream); /// Resume audio stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void ResumeAudioStream(AudioStream stream); /// Check if audio stream is playing [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial CBool IsAudioStreamPlaying(AudioStream stream); /// Stop audio stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void StopAudioStream(AudioStream stream); /// Set volume for audio stream (1.0 is max level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAudioStreamVolume(AudioStream stream, float volume); /// Set pitch for audio stream (1.0 is base level) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAudioStreamPitch(AudioStream stream, float pitch); /// Set pan for audio stream (-1.0 to 1.0 range, 0.0 is centered) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAudioStreamPan(AudioStream stream, float pan); /// Default size for new audio streams [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAudioStreamBufferSizeDefault(int size); /// Audio thread callback to request new data [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void SetAudioStreamCallback( AudioStream stream, delegate* unmanaged[Cdecl] callback ); /// Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void AttachAudioStreamProcessor( AudioStream stream, delegate* unmanaged[Cdecl] processor ); /// Detach audio stream processor from stream [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DetachAudioStreamProcessor( AudioStream stream, delegate* unmanaged[Cdecl] processor ); /// Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void AttachAudioMixedProcessor( delegate* unmanaged[Cdecl] processor ); /// Detach audio stream processor from the entire audio pipeline [LibraryImport(NativeLibName)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void DetachAudioMixedProcessor( delegate* unmanaged[Cdecl] processor ); }