Sdl3Sharp 0.0.1-test9
dotnet add package Sdl3Sharp --version 0.0.1-test9
NuGet\Install-Package Sdl3Sharp -Version 0.0.1-test9
<PackageReference Include="Sdl3Sharp" Version="0.0.1-test9" />
<PackageVersion Include="Sdl3Sharp" Version="0.0.1-test9" />
<PackageReference Include="Sdl3Sharp" />
paket add Sdl3Sharp --version 0.0.1-test9
#r "nuget: Sdl3Sharp, 0.0.1-test9"
#:package Sdl3Sharp@0.0.1-test9
#addin nuget:?package=Sdl3Sharp&version=0.0.1-test9&prerelease
#tool nuget:?package=Sdl3Sharp&version=0.0.1-test9&prerelease
SDL3#

About
SDL3# provides hand-crafted C# language bindings for SDL3.
In contrast to the promoted C# bindings (SDL3-CS), SDL3# is entirely hand-crafted, with no auto-generation of API code based on the native library.
Every part of the API is deliberately designed to feel native to C#, translating SDL's functionality into idiomatic, well thought-out counterparts that existing C# users should feel right at home with.
It makes heavy use of modern C# features to provide an API that is expressive and comfortable to work with from managed code, while still exposing the full breadth of SDL's functionality.
This project is a work in progress and is not yet complete or usable in production. The public .NET API is subject to change at any time and in any form without prior notice. Use at your own risk.
Building
For instructions on how to build the project from source, see BUILDING.md.
Usage
Requirements
- C# 14 or later
- .NET 10 or later
Adding SDL3# as a dependency
Via your IDE
(Example: Visual Studio)
Open the NuGet Package Manager, search for Sdl3Sharp, check "Include prerelease", and install the latest version.
Via .csproj
<PackageReference Include="Sdl3Sharp" Version="*-*" />
Via a file-based C# app
Add the following directive at the top of your file:
#:package Sdl3Sharp@*-*
Choosing a package variant
The default Sdl3Sharp package includes pre-built native SDL3 binaries for all supported platforms and is the easiest way to get started.
If you only need to target specific platforms, you can reference the corresponding RID-specific packages instead, for example Sdl3Sharp.win-x64 or Sdl3Sharp.linux-x64, rather than pulling in binaries for every platform.
If you do not want any native binaries bundled at all, reference Sdl3Sharp.Core instead. In that case you are responsible for providing the native SDL3 and libffi binaries yourself, placed alongside the resulting executable of your application.
Examples
Hello World
MessageBox.TryShowSimple(MessageBoxFlags.Information, "Hello World", "Hello World from SDL3#!");
Rendering a triangle
using var sdl = new Sdl(static builder => builder
.SetAppName("Simple SDL3# Triangle example")
.InitializeSubSystems(SubSystems.Video)
);
return sdl.Run(new App(), args);
class App : AppBase
{
private Window mWindow = default!;
private Renderer mRenderer = default!;
protected override AppResult OnInitialize(Sdl sdl, string[] args)
{
if (!Window.TryCreateWithRenderer("Hello World", 800, 600, out mWindow!, out mRenderer!))
{
return Failure;
}
return Continue;
}
protected override AppResult OnIterate(Sdl sdl)
{
mRenderer.DrawColorFloat = (0, 0, 0, 1);
mRenderer.TryClear();
mRenderer.TryRenderGeometry([
new Vertex(position: (400, 150), color: (1, 0, 0, 1), texCoord: default),
new Vertex(position: (200, 450), color: (0, 1, 0, 1), texCoord: default),
new Vertex(position: (600, 450), color: (0, 0, 1, 1), texCoord: default)
]);
mRenderer.TryRenderPresent();
return Continue;
}
protected override AppResult OnEvent(Sdl sdl, ref Event @event)
{
if (@event.Type is EventType.WindowCloseRequested)
{
return Success;
}
return Continue;
}
protected override void OnQuit(Sdl sdl, AppResult result)
{
mRenderer?.Dispose();
mRenderer = default!;
mWindow?.Dispose();
mWindow = default!;
}
}
The example above makes use of the AppBase lifetime model, where SDL3# manages the main loop for you. You implement OnInitialize, OnIterate, and OnEvent as callbacks, and SDL3# takes care of the rest.
If you prefer to manage the main loop yourself, you can do so: you still initialize SDL via new Sdl(...) and pump events on your own, without using AppBase at all.
A note on AI usage
In the spirit of transparency, and in line with the contributing guidelines, here is an overview of how AI was used in this project:
- Documentation. AI was used to help write and improve documentation. The content itself comes from the author, but AI was used to clarify and clean up the writing.
- API design. AI was used as a sounding board for API design decisions. Sometimes the options to consider came from the author, sometimes the AI had useful proposals to offer. All decisions were ultimately made by the author.
- Infrastructural documents. AI was used to help write project documents such as this README.md, the BUILDING.md, the CONTRIBUTING.md, and the CODE_OF_CONDUCT.md.
- Code review. AI was used to review some of the author's code, and occasionally this turned out to be fruitful, catching bugs that might otherwise have been overlooked.
- Functional code. No AI was used to write any functional code. All code in this project was written by the author.
License
SDL3# is licensed under the MIT License. See NOTICE.md for third-party notices.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Sdl3Sharp.Ffi (>= 0.5.0-alpha6)
- Sdl3Sharp.linux-arm (>= 0.0.1-test9)
- Sdl3Sharp.linux-arm64 (>= 0.0.1-test9)
- Sdl3Sharp.linux-x64 (>= 0.0.1-test9)
- Sdl3Sharp.linux-x86 (>= 0.0.1-test9)
- Sdl3Sharp.win-arm64 (>= 0.0.1-test9)
- Sdl3Sharp.win-x64 (>= 0.0.1-test9)
- Sdl3Sharp.win-x86 (>= 0.0.1-test9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-test9 | 18 | 3/12/2026 |
| 0.0.1-test8 | 68 | 2/14/2026 |
| 0.0.1-test7 | 62 | 2/13/2026 |
| 0.0.1-test6 | 248 | 12/19/2025 |
| 0.0.1-test5 | 342 | 12/7/2025 |
| 0.0.1-test4 | 240 | 12/4/2025 |
| 0.0.1-test3 | 295 | 11/14/2025 |
| 0.0.1-test2 | 267 | 10/22/2025 |
| 0.0.1-test1 | 263 | 10/21/2025 |