Graphix-CS is a packaging fork of SDL3-CS, based on upstream tag v3.4.16.0, commit c1d1cb0da632cb51799da6989f6e48c52f2a539e.
The managed NuGet package is Graphix-CS 3.4.16.1. This package revision updates distribution documentation without changing the binding or generator source, namespace SDL3, public class SDL, assembly SDL3-CS.dll, native entry points, original authorship, or license. Do not reference both Graphix-CS and SDL3-CS in the same application.
The public package feed is NuGet.org. Install the managed binding and, for the Graphix desktop runtime, its separate native package:
dotnet add package Graphix-CS --version 3.4.16.1
dotnet add package Graphix.Native --version 3.4.16-graphix.3Normal restore uses NuGet.org; it does not require a GitHub account, an Actions artifact, or a local package feed. CI still produces short-lived build artifacts for verification. Public releases use the exact verified package from the selected main commit; rebuilding or replacing bytes under an already-used package version is not allowed.
The package contains managed DLL/XML assets for .NET 7β10 and the existing callback generator. It contains no native runtime. Cerneala supplies its SDL-compatible runtime separately through Graphix.Native 3.4.16-graphix.3 from Graphix. That native prerelease contains six desktop RIDs: Windows, Linux and macOS on x64 and ARM64. The SDL3-CS.<Platform> companion packages described below are upstream packages, not renamed or published by this fork. Do not install another SDL3 native provider alongside Graphix.Native.
The inherited callback generator requires a Roslyn 5.9-compatible compiler, such as .NET SDK 10.0.400. This compiler requirement does not change the application's target framework. Older Roslyn 5.6 compiler hosts reject the generator with CS9057.
Local package verification (PowerShell 7 and .NET SDK 10.0.400):
dotnet pack ./SDL3-CS/SDL3-CS.csproj -c Release -p:PackageVersion=3.4.16.1 -o ./artifacts/graphix
./.github/release-tools/Test-NuGetPackageContents.ps1 -PackageRevision 1 -ManagedOnly -PackageDir ./artifacts/graphix
./.github/release-tools/Test-ManagedMainCallbacksPackage.ps1 -PackagePath ./artifacts/graphix/Graphix-CS.3.4.16.1.nupkg -PackageVersion 3.4.16.1The inherited release tooling remains subject to its release gates. CI artifact creation does not authorize NuGet publication or native package releases.
The following overview and examples are retained from SDL3-CS. Upstream documentation and contact links refer to the original project; fork-specific packaging issues belong in Graphix-CS issues.
Build cross-platform .NET applications with SDL3, SDL_image, SDL_ttf, SDL_mixer, and SDL_shadercross.
About - Versioning - Documentation - Platforms - Installation - Examples - Feedback - License
β Star us on GitHub - it motivates us a lot!
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 (this fork) | Graphix-CS |
SDL 3.4.16 |
3.4.16.1 |
| SDL3 native runtime | SDL3-CS.{Platform} |
SDL 3.4.16 |
3.4.16.x |
| SDL_image native runtime | SDL3-CS.{Platform}.Image |
SDL_image 3.4.6 |
3.4.6.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 the development state in main 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 Graphix-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 from NuGet.org:
dotnet add package Graphix-CS --version 3.4.16.1For Graphix desktop applications, use the separate Graphix.Native package shown in Fork distribution. The following upstream native packages are alternatives, not additional SDL3 providers to install alongside Graphix. For example, an application choosing the upstream Windows runtime instead uses:
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 that use SDL video, surfaces, input, or the full SDL lifecycle 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.
Audio-only applications can keep an existing Android Activity, including AvaloniaMainActivity, initialize the smaller SDL JNI/context bridge, and initialize only SDL.InitFlags.Audio. See the runnable Avalonia + SDL_mixer audio example for lifecycle, error handling, and an emulator/device smoke test. This narrower setup does not provide an SDL video surface inside the existing Activity.
git clone https://github.com/Chevalier12/Graphix-CS
cd Graphix-CS
dotnet build SDL3-CS.sln -c ReleaseSDL3-CS can generate the application entry point for SDL's main-callback lifecycle. Implement SDL.IMainCallbacks<TSelf> on a partial class and opt in with [SDL.GenerateMain]:
using SDL3;
[SDL.GenerateMain]
internal sealed partial class Game : SDL.IMainCallbacks<Game>
{
public static SDL.AppResult AppInit(out Game? appState, string[] args)
{
appState = new Game();
return SDL.AppResult.Continue;
}
public SDL.AppResult AppIterate() => SDL.AppResult.Continue;
public SDL.AppResult AppEvent(ref SDL.Event @event) =>
(SDL.EventType)@event.Type == SDL.EventType.Quit
? SDL.AppResult.Success
: SDL.AppResult.Continue;
public void AppQuit(SDL.AppResult result)
{
}
}The package generator creates Main(string[] args) and calls SDL.RunMainCallbacks<Game>. The runner manages the native app-state handle, callback lifetime, argument conversion, cleanup, and managed exception boundary. The existing low-level callback APIs remain available for applications that need direct control.
using 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.
Before contributing, read the contribution guide. Please follow the Code of Conduct in all project interactions.
For usage help, see the support guide. Report suspected vulnerabilities privately according to the security policy; do not disclose them in a public issue.
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.
