Sdl3Sharp.win-x86
0.0.2-alpha.5
dotnet add package Sdl3Sharp.win-x86 --version 0.0.2-alpha.5
NuGet\Install-Package Sdl3Sharp.win-x86 -Version 0.0.2-alpha.5
<PackageReference Include="Sdl3Sharp.win-x86" Version="0.0.2-alpha.5" />
<PackageVersion Include="Sdl3Sharp.win-x86" Version="0.0.2-alpha.5" />
<PackageReference Include="Sdl3Sharp.win-x86" />
paket add Sdl3Sharp.win-x86 --version 0.0.2-alpha.5
#r "nuget: Sdl3Sharp.win-x86, 0.0.2-alpha.5"
#:package Sdl3Sharp.win-x86@0.0.2-alpha.5
#addin nuget:?package=Sdl3Sharp.win-x86&version=0.0.2-alpha.5&prerelease
#tool nuget:?package=Sdl3Sharp.win-x86&version=0.0.2-alpha.5&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.
Documentation
At the moment, there's a very crude API documentation available under https://sdl3sharp.github.io/Sdl3Sharp/api/Sdl3Sharp.html.
For now it's very limited and kind of neglected, and it might stay that way for at least as long as DocFx has some major issues with C# 14 features. SDL3# makes heavy use of those features, which, in turn, renders the generated API documentation partially broken. For now, it might be at least useful as a starting point. For everything else, you'll have to rely on IntelliSense (or a comparable tool in the IDE of you choice) and the source code itself.
We'll improve the documentation eventually!
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
return new MyApp().Run(args);
class MyApp : App
{
private Sdl mSdl = default!;
private Window mWindow = default!;
private Renderer mRenderer = default!;
// Called once at the start of the application:
// Initialize SDL and whatever resources you need for your application.
protected override AppResult OnInitialize(string[] args)
{
mSdl = new Sdl(static builder => builder
.SetAppName("Simple SDL3# Triangle example")
.InitializeSubSystems(SubSystems.Video)
);
if (!Window.TryCreateWithRenderer("Hello World", 800, 600, out mWindow!, out mRenderer!))
{
return Failure;
}
return Continue;
}
// Called once per frame:
// Update your application state and render the next frame.
protected override AppResult OnIterate()
{
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;
}
// Called once per event whenever an event is received:
// Handle the event and update your application state accordingly.
protected override AppResult OnEvent(ref Event @event)
{
if (@event.Type is EventType.WindowCloseRequested)
{
return Success;
}
return Continue;
}
// Called whenever there was an unhandled exception in OnInitialize, OnIterate, or OnEvent:
// If possible, recover from the exception and continue, otherwise possibly log the exception and terminate the application gracefully.
protected override AppResult OnUnhandledException(ExceptionDispatchInfo info, AppUnhandledExceptionSource source)
{
MessageBox.TryShowSimple(MessageBoxFlags.Error, "Unhandled Exception", $"An unhandled exception occurred in {source}: [{info.SourceException.GetType().Name}] {info.SourceException.Message}");
return Failure;
}
// Called once at the end of the application (OnInitialize, OnIterate, OnEvent, or OnUnhandledException returned Failure or Success):
// Clean up any resources you allocated and deinitialize SDL.
protected override void OnQuit(AppResult result)
{
mRenderer?.Dispose();
mRenderer = default!;
mWindow?.Dispose();
mWindow = default!;
mSdl?.Dispose();
mSdl = default!;
}
}
The example above makes use of the App lifetime model, where SDL3# manages the main loop for you. You implement can OnInitialize, OnIterate, OnEvent, and OnUnhandledException 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 App 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.Core (>= 0.0.2-alpha.5)
- Sdl3Sharp.Ffi.win-x86 (>= 0.5.1-alpha.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Sdl3Sharp.win-x86:
| Package | Downloads |
|---|---|
|
Sdl3Sharp
SDL3# - SDL bindings for C#/.NET - "Meta" package - just references all of the native binary packages and by transitivity the "Core" package |
|
|
Sdl3Sharp.Ttf.win-x86
SDL3#'s SDL TTF bindings - "win-x86" package - just contains the native binaries for win-x86 and references the "Core" package |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.2-alpha.5 | 0 | 11/25/2026 |
| 0.0.2-alpha.4 | 154 | 6/23/2026 |
| 0.0.2-alpha.3 | 113 | 6/11/2026 |
| 0.0.2-alpha.2 | 84 | 6/11/2026 |
| 0.0.2-alpha.1 | 95 | 6/3/2026 |
| 0.0.1-test9 | 138 | 3/12/2026 |
| 0.0.1-test8 | 103 | 2/14/2026 |
| 0.0.1-test7 | 98 | 2/13/2026 |
| 0.0.1-test6 | 214 | 12/19/2025 |
| 0.0.1-test5 | 322 | 12/7/2025 |
| 0.0.1-test4 | 200 | 12/4/2025 |
| 0.0.1-test3 | 240 | 11/14/2025 |
| 0.0.1-test2 | 204 | 10/22/2025 |
| 0.0.1-test10 | 94 | 5/26/2026 |
| 0.0.1-test1 | 205 | 10/21/2025 |