SDL3-CS 3.4.14

dotnet add package SDL3-CS --version 3.4.14
                    
NuGet\Install-Package SDL3-CS -Version 3.4.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SDL3-CS" Version="3.4.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SDL3-CS" Version="3.4.14" />
                    
Directory.Packages.props
<PackageReference Include="SDL3-CS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SDL3-CS --version 3.4.14
                    
#r "nuget: SDL3-CS, 3.4.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SDL3-CS@3.4.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SDL3-CS&version=3.4.14
                    
Install as a Cake Addin
#tool nuget:?package=SDL3-CS&version=3.4.14
                    
Install as a Cake Tool

About

SDL3-CS is a C# wrapper for SDL3. The managed SDL3-CS package contains the C# wrapper, while native binaries are published as platform-specific package families.

Package Versions

This package set uses managed version SDL3-CS 3.4.14.0.

Package family Version
SDL3-CS 3.4.14.0
SDL3-CS.<Platform> 3.4.14.0
SDL3-CS.<Platform>.Image 3.4.4.9
SDL3-CS.<Platform>.Mixer 3.2.4.8
SDL3-CS.<Platform>.TTF 3.2.2.8
SDL3-CS.<Platform>.Shadercross 3.0.0.8

Documentation

Supported Platforms

The managed wrapper targets .NET 7, .NET 8, .NET 9, and .NET 10.

Platform family Native 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, android-arm64, android-x86, android-x64 Includes the SDL Android bridge in SDL3-CS.Android.
iOS iOS ios-arm64, iossimulator-arm64, iossimulator-x64 Static native assets are linked through package buildTransitive targets.
tvOS tvOS tvos-arm64, tvossimulator-arm64, tvossimulator-x64 Static native assets are linked through package buildTransitive targets.

Installation

Install the managed wrapper:

dotnet add package SDL3-CS

Add the native package family that matches your target platform. For a Windows desktop app:

dotnet add package SDL3-CS.Windows
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.Shadercross

Replace Windows with Linux, MacOS, Android, iOS, or tvOS.

Platform SDL SDL_image SDL_ttf SDL_mixer SDL_shadercross
Windows SDL3-CS.Windows SDL3-CS.Windows.Image SDL3-CS.Windows.TTF SDL3-CS.Windows.Mixer SDL3-CS.Windows.Shadercross
Linux SDL3-CS.Linux SDL3-CS.Linux.Image SDL3-CS.Linux.TTF SDL3-CS.Linux.Mixer SDL3-CS.Linux.Shadercross
macOS SDL3-CS.MacOS SDL3-CS.MacOS.Image SDL3-CS.MacOS.TTF SDL3-CS.MacOS.Mixer SDL3-CS.MacOS.Shadercross
Android SDL3-CS.Android SDL3-CS.Android.Image SDL3-CS.Android.TTF SDL3-CS.Android.Mixer SDL3-CS.Android.Shadercross
iOS SDL3-CS.iOS SDL3-CS.iOS.Image SDL3-CS.iOS.TTF SDL3-CS.iOS.Mixer SDL3-CS.iOS.Shadercross
tvOS SDL3-CS.tvOS SDL3-CS.tvOS.Image SDL3-CS.tvOS.TTF SDL3-CS.tvOS.Mixer SDL3-CS.tvOS.Shadercross

Android applications use MainActivity : Org.Libsdl.App.SDLActivity, override GetLibraries(), and run SDL from the managed Main() override.

Managed Main Callbacks

For SDL's callback-based application lifecycle, implement SDL.IMainCallbacks<TSelf> and apply [SDL.GenerateMain] to the partial application class:

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)
    {
    }
}

SDL3-CS supplies the source generator through the package's analyzer assets. It creates the entry point and delegates to SDL.RunMainCallbacks<TApp>, which owns the managed/native state lifetime and contains managed exceptions until SDL returns control to the caller.

Example

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();
    }
}

Feedback and Contributions

Open an issue or start a discussion for bugs, ideas, and questions.

See the repository README for the full project overview.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (15)

Showing the top 5 NuGet packages that depend on SDL3-CS:

Package Downloads
3DEngine

3D Game Engine - Vulkan - SDL3 - .NET 10 - C# 14

Bliss

A fast, Cross-platform .NET 10 C# 14 Render Framework.

SdlVulkan.Renderer

Package Description

StreamLayout

Package Description

Line.Framework

A Game Framework

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SDL3-CS:

Repository Stars
Valkirie/HandheldCompanion
A touch optimized GUI to increase your handheld gaming computer experience.
Version Downloads Last Updated
3.4.14 160 8/4/2026
3.4.12.4 297 7/27/2026
3.4.12.3 2,845 7/15/2026
3.4.12.2 170 7/13/2026
3.4.12.1 341 7/10/2026
3.4.12 222 7/8/2026
3.4.10.5 1,935 6/27/2026
3.4.10.4 484 6/24/2026
3.4.10.3 2,111 6/20/2026
3.4.10.2 1,037 6/14/2026
3.4.10.1 147 6/13/2026
3.4.2 6,507 3/17/2026
3.3.7 6,964 1/12/2026
Loading failed