### Run FPS Counter Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Basics/FPS Counter/README.md Command to build and run the FPS Counter example from the repository root. Ensure the .NET 10 SDK is installed and the project path is correct. ```bash dotnet run --project ".\SDL3-CS.Examples\Basics\FPS Counter\FPS Counter.csproj" -c Release ``` -------------------------------- ### Run Color Quantization Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Image/Color Quantization/README.md Command to execute the color quantization example from the repository root. Ensure you have the .NET 10 SDK installed. ```powershell dotnet run --project ".\SDL3-CS.Examples\Image\Color Quantization\Color Quantization.csproj" -c Release ``` -------------------------------- ### Run Misc Power Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Misc/Misc Power/README.md Command to run the Misc Power example from the repository root. Ensure you have the .NET 10 SDK installed. ```bash dotnet run --project ".\SDL3-CS.Examples\Misc\Misc Power\Misc Power.csproj" -c Release ``` -------------------------------- ### Run Camera Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Camera/Camera/README.md Execute the camera example project from the repository root using the .NET CLI. Ensure you are in the repository root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Camera\Camera\Camera.csproj" -c Release ``` -------------------------------- ### Run File Dialog Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Dialogs/File Dialog/README.md Command to run the file dialog example from the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Dialogs\File Dialog\File Dialog.csproj" -c Release ``` -------------------------------- ### Run Message Box Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Dialogs/Message Box/README.md Command to execute the Message Box example project from the repository root. ```bash dotnet run --project ".\SDL3-CS.Examples\Dialogs\Message Box\Message Box.csproj" -c Release ``` -------------------------------- ### Run Audio Simple Playback Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Audio/Audio Simple Playback/README.md Execute the Audio Simple Playback example using the .NET CLI. Ensure you are in the repository root. ```bash dotnet run --project ".\SDL3-CS.Examples\Audio\Audio Simple Playback\Audio Simple Playback.csproj" -c Release ``` -------------------------------- ### Run Renderer Viewport Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Viewport/README.md Execute the Renderer Viewport example using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Viewport\Renderer Viewport.csproj" -c Release ``` -------------------------------- ### Run SDL3-CS Create Window Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Basics/Create Window/README.md Command to run the Create Window example from the repository root. Ensure you are in the correct directory and specify the release configuration. ```bash dotnet run --project ".\SDL3-CS.Examples\Basics\Create Window\Create Window.csproj" -c Release ``` -------------------------------- ### Run Audio Load WAV Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Audio/Audio Load WAV/README.md Executes the Audio Load WAV example project using the .NET CLI. Ensure you are in the repository root. ```bash dotnet run --project ".\SDL3-CS.Examples\Audio\Audio Load WAV\Audio Load WAV.csproj" -c Release ``` -------------------------------- ### Run Renderer Textures Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Textures/README.md Command to execute the Renderer Textures example project from the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Textures\Renderer Textures.csproj" -c Release ``` -------------------------------- ### Run Renderer Lines Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Lines/README.md Execute the Renderer Lines example project using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Lines\Renderer Lines.csproj" -c Release ``` -------------------------------- ### Run Camera Read And Draw Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Camera/Camera Read And Draw/README.md Command to run the Camera Read And Draw example from the repository root. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Camera\Camera Read And Draw\Camera Read And Draw.csproj" -c Release ``` -------------------------------- ### Run Pen Drawing Lines Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Pen/Pen Drawing Lines/README.md Command to execute the Pen Drawing Lines example from the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Pen\Pen Drawing Lines\Pen Drawing Lines.csproj" -c Release ``` -------------------------------- ### Run Input Gamepad Events Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Input/Input Gamepad Events/README.md Command to run the Input Gamepad Events example from the repository root. Ensure you are in the repository root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Input\Input Gamepad Events\Input Gamepad Events.csproj" -c Release ``` -------------------------------- ### Run Input Gamepad Rumble Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Input/Input Gamepad Rumble/README.md Command to run the Input Gamepad Rumble example from the repository root. Ensure you are in the repository root directory before executing. ```bash dotnet run --project ".\SDL3-CS.Examples\Input\Input Gamepad Rumble\Input Gamepad Rumble.csproj" -c Release ``` -------------------------------- ### Run Renderer Primitives Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Primitives/README.md Command to run the Renderer Primitives example from the repository root. Ensure you are in the repository root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Primitives\Renderer Primitives.csproj" -c Release ``` -------------------------------- ### Run Misc Clipboard Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Misc/Misc Clipboard/README.md Command to run the Misc Clipboard example from the repository root. Ensure you are in the repository root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Misc\Misc Clipboard\Misc Clipboard.csproj" -c Release ``` -------------------------------- ### Run Audio Planar Data Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Audio/Audio Planar Data/README.md Executes the Audio Planar Data example project using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Audio\Audio Planar Data\Audio Planar Data.csproj" -c Release ``` -------------------------------- ### Run Renderer Points Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Points/README.md Command to run the Renderer Points example from the repository root. Ensure you have the .NET 10 SDK and a supported platform. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Points\Renderer Points.csproj" -c Release ``` -------------------------------- ### Example Usage of SDL_INIT_INTERFACE Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Demonstrates initializing an SDL interface and opening a stream. This example shows both direct initialization and using designated initializers. ```c SDL_IOStreamInterface iface; SDL_INIT_INTERFACE(&iface); // Fill in the interface function pointers with your implementation iface.seek = ... stream = SDL_OpenIO(&iface, NULL); ``` ```c SDL_IOStreamInterface iface = { .version = sizeof(iface), .seek = ... }; stream = SDL_OpenIO(&iface, NULL); ``` -------------------------------- ### Run Gamepad Polling Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Input/Input Gamepad Polling/README.md Execute the Input Gamepad Polling example from the repository root. Ensure you are in the correct directory and specify the project and configuration. ```powershell dotnet run --project ".\SDL3-CS.Examples\Input\Input Gamepad Polling\Input Gamepad Polling.csproj" -c Release ``` -------------------------------- ### Run Renderer Color Mods Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Color Mods/README.md Command to run the Renderer Color Mods example project from the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Color Mods\Renderer Color Mods.csproj" -c Release ``` -------------------------------- ### Run VHS Camera Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Camera/VHS Camera/README.md Command to run the VHS Camera example from the repository root. Ensure you are in the repository's root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Camera\VHS Camera\VHS Camera.csproj" -c Release ``` -------------------------------- ### Run Renderer Cliprect Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Cliprect/README.md Execute the Renderer Cliprect example using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Cliprect\Renderer Cliprect.csproj" -c Release ``` -------------------------------- ### Run Renderer Clear Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Clear/README.md Command to run the Renderer Clear example from the repository root. Ensure you are in the repository's root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Clear\Renderer Clear.csproj" -c Release ``` -------------------------------- ### Run Renderer Rectangles Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Rectangles/README.md Command to run the Renderer Rectangles example from the repository root. Ensure you are in the repository root directory before executing. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Rectangles\Renderer Rectangles.csproj" -c Release ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Windows.Image/README.md Installs the core SDL3-CS package, the Windows-specific runtime, and the image loading extension for Windows. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Windows dotnet add package SDL3-CS.Windows.Image ``` -------------------------------- ### Run Renderer Rotating Textures Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Rotating Textures/README.md Command to execute the Renderer Rotating Textures example project. Ensure you are in the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Rotating Textures\Renderer Rotating Textures.csproj" -c Release ``` -------------------------------- ### Run Renderer Blending Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Blending/README.md Command to run the Renderer Blending example project from the repository root. Ensure you are in the repository's root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Blending\Renderer Blending.csproj" -c Release ``` -------------------------------- ### Run Renderer Read Pixels Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Read Pixels/README.md Command to run the Renderer Read Pixels example from the repository root. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Read Pixels\Renderer Read Pixels.csproj" -c Release ``` -------------------------------- ### Run Mixer Track Playback Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Mixer/Mixer Track Playback/README.md Command to execute the Mixer Track Playback example from the repository root. Ensure you are in the repository's root directory before running. ```powershell dotnet run --project ".\SDL3-CS.Examples\Mixer\Mixer Track Playback\Mixer Track Playback.csproj" -c Release ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.MacOS.TTF/README.md Installs the base SDL3-CS package, the macOS core runtime, and the macOS TTF extension package. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.MacOS dotnet add package SDL3-CS.MacOS.TTF ``` -------------------------------- ### Run Asyncio Load Bitmaps Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Asyncio/Asyncio Load Bitmaps/README.md Command to run the Asyncio Load Bitmaps example from the repository root. Ensure you are in the repository's root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Asyncio\Asyncio Load Bitmaps\Asyncio Load Bitmaps.csproj" -c Release ``` -------------------------------- ### Install SDL3-CS Packages for tvOS Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.tvOS.TTF/README.md Installs the core SDL3-CS package, the tvOS base runtime, and the tvOS TTF extension package. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.tvOS dotnet add package SDL3-CS.tvOS.TTF ``` -------------------------------- ### Run Debug Text Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Debug Text/README.md Execute the debug text rendering example from the repository root using the .NET CLI. Ensure you are in the repository's root directory. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Debug Text\Renderer Debug Text.csproj" -c Release ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Windows.Shadercross/README.md Installs the core SDL3-CS package, the Windows base runtime, and the Shadercross add-on package using the .NET CLI. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Windows dotnet add package SDL3-CS.Windows.Shadercross ``` -------------------------------- ### Install SDL3-CS Packages on Linux Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Linux.TTF/README.md Installs the core SDL3-CS package, the Linux base runtime, and the Linux TTF extension package. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Linux dotnet add package SDL3-CS.Linux.TTF ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Windows.TTF/README.md Use the dotnet CLI to add the necessary SDL3-CS packages for Windows TTF support. Ensure all packages are installed in the same project. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Windows dotnet add package SDL3-CS.Windows.TTF ``` -------------------------------- ### Get Joystick GUID from Handle (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the implementation-dependent GUID for an opened joystick. Requires an open joystick handle. ```csharp public static SDL.GUID GetJoystickGUID(IntPtr joystick); ``` -------------------------------- ### Install SDL3-CS Packages for tvOS Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.tvOS.Image/README.md Installs the base SDL3-CS package, the tvOS platform package, and the tvOS image package using the .NET CLI. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.tvOS dotnet add package SDL3-CS.tvOS.Image ``` -------------------------------- ### Run Circular Color Fade Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Basics/Circular Color Fade/README.md Executes the Circular Color Fade example project using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Basics\Circular Color Fade\Circular Color Fade.csproj" -c Release ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Windows.Mixer/README.md Installs the base SDL3-CS package, the Windows-specific runtime, and the Windows Mixer extension. Ensure all SDL3-CS packages are on the same platform family. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Windows dotnet add package SDL3-CS.Windows.Mixer ``` -------------------------------- ### Get Joystick GUID by Instance ID (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the implementation-dependent GUID of a joystick using its instance ID. This can be called before any joysticks are opened. ```csharp public static SDL.GUID GetJoystickGUIDForID(uint instanceId); ``` -------------------------------- ### Run Audio Simple Playback Callback Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Audio/Audio Simple Playback Callback/README.md Executes the Audio Simple Playback Callback example using the .NET CLI. Ensure you are in the repository root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Audio\Audio Simple Playback Callback\Audio Simple Playback Callback.csproj" -c Release ``` -------------------------------- ### Get Gamepad GUID For ID (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the implementation-dependent GUID of a gamepad using its instance ID. This can be called before any gamepads are opened and is thread-safe. Available since SDL 3.2.0. ```csharp public static SDL.GUID GetGamepadGUIDForID(uint instanceID); ``` ```c extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id); ``` -------------------------------- ### Get Gamepad Mapping For GUID (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the gamepad mapping string for a given GUID. The returned string should be freed with SDL.Free when no longer needed. Available since SDL 3.2.0. ```csharp public static string GetGamepadMappingForGUID(SDL.GUID guid); ``` ```c extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); ``` -------------------------------- ### Run Audio Multiple Streams Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Audio/Audio Multiple Streams/README.md Execute the Audio Multiple Streams example from the repository root using the .NET CLI. Ensure you are in the repository's root directory. ```bash dotnet run --project ".\SDL3-CS.Examples\Audio\Audio Multiple Streams\Audio Multiple Streams.csproj" -c Release ``` -------------------------------- ### Get Process Environment Pointer Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves a pointer to the process environment. This is initialized at application start and is thread-safe. ```csharp public static IntPtr GetEnvironment(); ``` ```c extern SDL_DECLSPEC SDL_Environment * SDLCALL SDL_GetEnvironment(void); ``` -------------------------------- ### Create SDL3 Window and Renderer Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/README-nuget.md A basic C# example demonstrating how to initialize SDL3, create a window and renderer, set a background color, present it, and then clean up resources. ```csharp using SDL3; namespace CreateWindow; internal static class Program { [STAThread] private static void Main() { if (!SDL.Init(SDL.InitFlags.Video)) { SDL.LogError(SDL.LogCategory.System, $"SDL could not initialize: {SDL.GetError()}"); return; } if (!SDL.CreateWindowAndRenderer("SDL3 Create Window", 800, 600, 0, out var window, out var renderer)) { SDL.LogError(SDL.LogCategory.Application, $"Error creating window and renderer: {SDL.GetError()}"); return; } SDL.SetRenderDrawColor(renderer, 100, 149, 237, 255); SDL.RenderClear(renderer); SDL.RenderPresent(renderer); SDL.DestroyRenderer(renderer); SDL.DestroyWindow(window); SDL.Quit(); } } ``` -------------------------------- ### Get Previous Text Substring (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-TTF Get the previous substring in a text object. If called at the start of the text, this will return a zero length substring with the TTF.SubStringFlags.TextStart flag set. Should be called on the thread that created the text. ```csharp public static bool GetPreviousTextSubString(IntPtr text, in TTF.SubString substring, out TTF.SubString previous); ``` ```c extern SDL_DECLSPEC bool SDLCALL TTF_GetPreviousTextSubString(TTF_Text *text, const TTF_SubString *substring, TTF_SubString *previous); ``` -------------------------------- ### Get Audio Byte Size from Format (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the size, in bytes, of an SDL_AudioFormat. For example, it returns 2 for AudioS16. ```csharp public static uint AudioByteSize(uint x); ``` -------------------------------- ### Get Audio Bit Size from Format (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Retrieves the size, in bits, of an SDL_AudioFormat. For example, it returns 16 for AudioS16. ```csharp public static uint AudioBitSize(uint x); ``` -------------------------------- ### Get Joystick Button State (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Checks the current pressed state of a specific joystick button. Indices start at 0. ```csharp public static bool GetJoystickButton(IntPtr joystick, int button); ``` ```c extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, int button); ``` -------------------------------- ### Get Joystick GUID Info (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Decodes device information (vendor, product, version, CRC16) from a SDL.GUID structure. Pointers are filled with device information or 0 if unavailable. ```csharp public static void GetJoystickGUIDInfo(SDL.GUID guid, out short vendor, out short product, out short version, out short crc16); ``` -------------------------------- ### Get Android SDK Version (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Queries the Android API level of the current device. This function is thread-safe. It returns the integer API level, for example, 33 for Android 13 (TIRAMISU). ```csharp public static int GetAndroidSDKVersion(); ``` -------------------------------- ### Run Release Build Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Geometry/README.md Command to run the example in release mode from the repository root. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Geometry\Renderer Geometry.csproj" -c Release ``` -------------------------------- ### Get Text Substring for Line (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-TTF Retrieves the substring of a text object that contains the specified line. Handles out-of-bounds line indices by returning zero-length substrings at the text's start or end. ```csharp public static bool GetTextSubStringForLine(IntPtr text, int line, out TTF.SubString substring); ``` -------------------------------- ### Open Audio Device Stream in C# Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL This C# signature is a wrapper for opening an audio device and creating a stream. It simplifies audio setup for common use cases, allowing for a single-call initialization. The audio device is managed by the stream and closed upon destruction. The device starts paused and requires explicit resumption. ```csharp public static IntPtr OpenAudioDeviceStream(uint devid, IntPtr spec, SDL.AudioStreamCallback callback, IntPtr userdata); ``` -------------------------------- ### Run SDL3-CS Renderer Affine Textures Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Renderer/Renderer Affine Textures/README.md Command to execute the Renderer Affine Textures example from the repository root. Ensure you are in the repository root and specify the Release configuration. ```powershell dotnet run --project ".\SDL3-CS.Examples\Renderer\Renderer Affine Textures\Renderer Affine Textures.csproj" -c Release ``` -------------------------------- ### Launch SDL Application Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Initializes SDL, calls a provided main function, and performs platform-specific setup/cleanup. Use this to integrate SDL with custom main() implementations, avoiding the need for `SDL.SetMainReady`. ```csharp public static int RunApp(int argc, string[] argv, SDL.MainFunc mainFunction, IntPtr reserved); ``` ```c extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void *reserved); ``` -------------------------------- ### Get System Theme in C Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Get the current system theme. This function should only be called on the main thread. ```c extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); ``` -------------------------------- ### Get System RAM in C Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Get the amount of RAM configured in the system. The value is returned in MiB. ```c extern SDL_DECLSPEC int SDLCALL SDL_GetSystemRAM(void); ``` -------------------------------- ### Get Display For Window (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the display associated with a window. This function should only be called on the main thread. ```csharp public static uint GetDisplayForWindow(IntPtr window); ``` -------------------------------- ### Get Surface Properties in C Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Get the properties associated with a surface. This C declaration is used internally by SDL. ```c extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface); ``` -------------------------------- ### Get Display For Point (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the display that contains a given point. This function should only be called on the main thread. ```csharp public static uint GetDisplayForPoint(SDL.Point point); ``` -------------------------------- ### Get Animation Decoder Status Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-Image Gets the current status of an animation decoder. Returns `Image.AnimationDecoderStatus.Invalid` if the decoder is invalid. ```csharp public static Image.AnimationDecoderStatus GetAnimationDecoderStatus(IntPtr decoder); ``` ```c extern SDL_DECLSPEC IMG_AnimationDecoderStatus SDLCALL IMG_GetAnimationDecoderStatus(IMG_AnimationDecoder *decoder); ``` -------------------------------- ### Get Joystick Product Version (C) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the product version of an opened joystick. Returns 0 if the version is unavailable. ```c extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProductVersion(SDL_Joystick *joystick); ``` -------------------------------- ### Get Joystick Product Version (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the product version of an opened joystick. Returns 0 if the version is unavailable. ```csharp public static ushort GetJoystickProductVersion(IntPtr joystick); ``` -------------------------------- ### SDL.AppInit Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL The app-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps. It should perform one-time setup and return a result indicating whether to continue, succeed, or fail. ```APIDOC ## `SDL.AppInit` ### Description App-implemented initial entry point for SDL_MAIN_USE_CALLBACKS apps. This function is called by SDL once at startup to perform necessary initializations. ### Method `public static SDL.AppResult AppInit(IntPtr appstate, int argc, string[] argv)` ### Parameters #### Path Parameters - `appstate` (IntPtr) - Optional - A place where the app can optionally store a pointer for future use. - `argc` (int) - Required - The standard ANSI C main's argc; number of elements in `argv`. - `argv` (string[]) - Required - The standard ANSI C main's argv; array of command line arguments. ### Returns - `SDL.AppResult.Failure`: to terminate with an error. - `SDL.AppResult.Success`: to terminate with success. - `SDL.AppResult.Continue`: to continue to normal operation. ### Since This function is available since SDL 3.2.0 ``` -------------------------------- ### Get Display For Rect (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the display that primarily contains a given rectangle. This function should only be called on the main thread. ```csharp public static uint GetDisplayForRect(SDL.Rect rect); ``` -------------------------------- ### Get Audio Stream Frequency Ratio Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Get the frequency ratio of an audio stream. It is safe to call this function from any thread. ```csharp public static float GetAudioStreamFrequencyRatio(IntPtr stream); ``` ```c extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream); ``` -------------------------------- ### Install SDL3-CS Packages Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.MacOS.Shadercross/README.md Installs the core SDL3-CS package, the macOS base runtime, and the macOS Shadercross add-on package. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.MacOS dotnet add package SDL3-CS.MacOS.Shadercross ``` -------------------------------- ### Install SDL3-CS Android TTF Package Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.NativePackages/SDL3-CS.Android.TTF/README.md Installs the core SDL3-CS, SDL3-CS.Android, and SDL3-CS.Android.TTF packages using the .NET CLI. ```powershell dotnet add package SDL3-CS dotnet add package SDL3-CS.Android dotnet add package SDL3-CS.Android.TTF ``` -------------------------------- ### Run Input Joystick Events Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Input/Input Joystick Events/README.md Execute the Input Joystick Events example from the repository root using the .NET CLI. Ensure you are in the repository root directory and specify the correct project path and release configuration. ```bash dotnet run --project ".\SDL3-CS.Examples\Input\Input Joystick Events\Input Joystick Events.csproj" -c Release ``` -------------------------------- ### Run Input Joystick Polling Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Input/Input Joystick Polling/README.md This command executes the Input Joystick Polling example from the repository root. Ensure you have the .NET 10 SDK and the necessary platform support. ```powershell dotnet run --project ".\SDL3-CS.Examples\Input\Input Joystick Polling\Input Joystick Polling.csproj" -c Release ``` -------------------------------- ### Get Number of Video Drivers (C#) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the number of video drivers compiled into SDL. This function should only be called on the main thread. ```csharp public static int GetNumVideoDrivers(); ``` ```c extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); ``` -------------------------------- ### Main: Application entry point Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL This is the app-supplied function for program entry. Apps should create a standard ANSI-C `main` function, and SDL will handle redefinition if necessary. Refer to SDL documentation for detailed explanations on program startup. ```csharp public static int Main(int argc, string[] argv); ``` ```c extern SDLMAIN_DECLSPEC int SDLCALL SDL_main(int argc, char *argv[]); ``` -------------------------------- ### Get Joystick Product ID (C) Source: https://github.com/edwardgushchin/sdl3-cs/wiki/API-SDL Gets the USB product ID of an opened joystick. Returns 0 if the ID is unavailable. ```c extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickProduct(SDL_Joystick *joystick); ``` -------------------------------- ### Build and Run AndroidCircularColorFade Example Source: https://github.com/edwardgushchin/sdl3-cs/blob/main/SDL3-CS.Examples/Android/AndroidCircularColorFade/README.md Commands to restore workloads, build the project for Android, and prepare for deployment. ```powershell dotnet workload restore .\SDL3-CS.Examples\Android\AndroidCircularColorFade\AndroidCircularColorFade.csproj dotnet build .\SDL3-CS.Examples\Android\AndroidCircularColorFade\AndroidCircularColorFade.csproj -c Release -f net10.0-android ```