Build cross-platform .NET applications with SDL3, SDL_image, SDL_ttf, SDL_mixer, and SDL_shadercross.
About - Versioning - Documentation - Platforms - Installation - Examples - Feedback - License
SDL3# is a C# wrapper and native package set for SDL3. It gives .NET applications direct access to SDL3 APIs while keeping native runtime distribution predictable across desktop, mobile, and Apple TV targets.
The repository contains:
- managed C# bindings for SDL3, SDL_image, SDL_ttf, SDL_mixer, and SDL_shadercross;
- platform-specific native NuGet packages for Windows, Linux, macOS, Android, iOS, and tvOS;
- Android SDLActivity bridge bindings for managed Android applications;
- examples that cover window creation, rendering, input, audio, images, fonts, GPU usage, and mobile app setup;
- release tooling and tests that validate package layout, native assets, and wrapper metadata.
SDL3# is intended for developers who want low-level SDL3 access from modern .NET without maintaining a separate native binary distribution pipeline for every supported platform.
SDL3# package versions follow the native SDL component versions. The first three version segments identify the upstream native component version. The final segment is the SDL3# package revision and may contain binding, packaging, or documentation fixes.
This source tree targets the following release lines:
| Component | Package pattern | Native target | Package line |
|---|---|---|---|
| SDL3 managed bindings | SDL3-CS |
SDL 3.4.10 |
3.4.10.x |
| SDL3 native runtime | SDL3-CS.{Platform} |
SDL 3.4.10 |
3.4.10.x |
| SDL_image native runtime | SDL3-CS.{Platform}.Image |
SDL_image 3.4.4 |
3.4.4.x |
| SDL_ttf native runtime | SDL3-CS.{Platform}.TTF |
SDL_ttf 3.2.2 |
3.2.2.x |
| SDL_mixer native runtime | SDL3-CS.{Platform}.Mixer |
SDL_mixer 3.2.4 |
3.2.4.x |
| SDL_shadercross native runtime | SDL3-CS.{Platform}.Shadercross |
SDL_shadercross 3.0.0 |
3.0.0.x |
{Platform} is one of Windows, Linux, MacOS, Android, iOS, or tvOS.
Published NuGet packages can lag behind a release branch while native packages are being assembled. The NuGet badge, package pages, and GitHub Releases are authoritative for what is currently published.
Project documentation lives in the SDL3-CS Wiki. Use the wiki, examples, and GitHub Releases for version notes, migration guidance, platform details, and release documentation.
For upstream SDL API documentation, see the official SDL3 Wiki.
The managed SDL3-CS wrapper targets .NET 7, .NET 8, .NET 9, and .NET 10.
Official native package families are built for the following release targets:
| Platform family | Package suffix | Supported RIDs / ABIs | Notes |
|---|---|---|---|
| Windows | Windows |
win-x86, win-x64, win-arm64 |
Dynamic SDL libraries for desktop Windows apps. |
| Linux | Linux |
linux-x64, linux-arm64 |
Built against glibc 2.28 or newer. |
| macOS | MacOS |
osx-x64, osx-arm64 |
Dynamic SDL libraries for Intel and Apple Silicon macOS apps. |
| Android | Android |
android-arm (armeabi-v7a), android-arm64 (arm64-v8a), android-x86 (x86), android-x64 (x86_64) |
Includes SDL Android bridge bindings and ABI-specific native libraries. |
| iOS | iOS |
ios-arm64, iossimulator-arm64, iossimulator-x64 |
Static native assets are linked through package build targets. |
| tvOS | tvOS |
tvos-arm64, tvossimulator-arm64, tvossimulator-x64 |
Static native assets are linked through package build targets. |
Other platforms can use the managed bindings if the application supplies compatible SDL native libraries manually.
Install the managed bindings:
dotnet add package SDL3-CSAdd the native package for your target platform:
dotnet add package SDL3-CS.WindowsReplace Windows with the package suffix for your target platform:
| Target platform | Package suffix |
|---|---|
| Windows | Windows |
| Linux | Linux |
| macOS | MacOS |
| Android | Android |
| iOS | iOS |
| tvOS | tvOS |
Optional SDL companion libraries use the same platform suffix:
dotnet add package SDL3-CS.Windows.Image
dotnet add package SDL3-CS.Windows.TTF
dotnet add package SDL3-CS.Windows.Mixer
dotnet add package SDL3-CS.Windows.ShadercrossUse the same platform suffix for every SDL3# package in the same application.
Android applications should reference SDL3-CS.Android and use MainActivity : Org.Libsdl.App.SDLActivity with a managed Main() override. The Android package includes the SDL Java bridge bindings and ABI-specific libSDL3.so files.
git clone https://github.com/edwardgushchin/SDL3-CS
cd SDL3-CS
dotnet build SDL3-CS.sln -c Releaseusing SDL3;
namespace Create_Window;
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 rendering: {SDL.GetError()}");
return;
}
SDL.SetRenderDrawColor(renderer, 100, 149, 237, 255);
var loop = true;
while (loop)
{
while (SDL.PollEvent(out var e))
{
if ((SDL.EventType)e.Type == SDL.EventType.Quit)
{
loop = false;
}
}
SDL.RenderClear(renderer);
SDL.RenderPresent(renderer);
}
SDL.DestroyRenderer(renderer);
SDL.DestroyWindow(window);
SDL.Quit();
}
}More examples can be found in SDL3-CS.Examples.
Found a bug or have an idea? Open an issue or start a discussion.
Please follow the Code of Conduct in all project interactions.
You can contact the maintainer at eduardgushchin@yandex.ru or join the Telegram chat for questions and feedback.
See the full list of contributors who participated in this project.
SDL3 and SDL3# are released under the zlib license. See LICENSE for details.