Simple DirectMedia Layer (SDL) is a popular free and open source library for developers that handles audio, keyboard, mouse, joystick and graphics with SDL 3 now available. Plus a new SDL 2 to SDL 3 compatibility layer.
Much like they already have sdl12-compat, which allows you to use SDL 2 if you're stuck on SDL 1, they've also released sdl2-compat for people stuck on SDL 2 to get the benefits of SDL 3.
There's a huge amount of new features and overall improvements including (taken from the SDL 3 release post):
- Extremely good documentation: We've spent a ton of effort writing and revising the API reference.
- Example programs to get you started, running in your web browser!
- More consistent API naming conventions. Everything is named consistently across the API now, instead of different subsystems taking different approaches. Also, we've tended toward more descriptive names for things in SDL3.
- Main Callbacks: optionally run your program from callbacks instead of main().
- GPU API: access to modern 3D rendering and GPU compute in a cross-platform way.
- Dialog API: access to system file dialogs (file and folder selection UI for opening/saving).
- Filesystem API: simple directory management and globbing, access to topic-specific user folders.
- Storage API: Abstract interface to platform-specific storage.
- Camera API: access to webcams.
- Pen API: access to pens (like Wacom tablets and Apple Pencil, etc).
- Logical audio devices: different parts of an app can get their own unique audio device to use.
- Audio streams: handle buffering, converting, resampling, mixing, channel mapping, pitch, and gain. Bind to an audio device and go!
- Default audio devices: SDL3 will automatically manage migrating to new physical hardware as devices are plugged in, ripped out, or changed.
- Properties API: fast, flexible dictionaries of name/value pairs.
- Process API: Spawn child processes and communicate with them in various ways.
- Colorspace support: Surfaces and the renderer, etc, can manage multiple colorspaces.
- The Clipboard API can support any data type (SDL2 only handled text), and apps can provide data in multiple formats upon request in a provided callback.
- Better keyboard input, for all your keypress needs.
- Customizable virtual keyboards on iOS and Android.
- High DPI support is dramatically improved over SDL2.
- App metadata API for letting SDL report things about your app correctly (like in the About dialog on macOS, etc).
- and much, much more.
Some you may have missed, popular articles from the last month:
You can also find comments for this article on social media: Mastodon
All posts need to follow our rules. For users logged in: please hit the Report Flag icon on any post that breaks the rules or contains illegal / harmful content. Guest readers can email us for any issues.
I believe SDL3 is defaulting to Wayland because the requisite protocols have been merged, but it would be nice to have confirmation.
0 Likes
I found out about the existence of SDL3 recently, but since it isn't in any repositories to my knowledge I instead decided to try learning SDL2 instead. Didn't get super far because trying to get Cargo to notice the assets folder was an exercise in frustration and basically required learning another whole library, but hey.
My language of choice is Rust and I was able to get a crate for SDL3 it at least. That does require sourcing the SDL3 C libraries from elsewhere though and I wasn't in the mood to compile it. If SDL3 gets added to Fedora's and Arch's repos then I'll absolutely look into it, even if it means having to write makefiles and subjecting myself to C++
My language of choice is Rust and I was able to get a crate for SDL3 it at least. That does require sourcing the SDL3 C libraries from elsewhere though and I wasn't in the mood to compile it. If SDL3 gets added to Fedora's and Arch's repos then I'll absolutely look into it, even if it means having to write makefiles and subjecting myself to C++
0 Likes
> I believe SDL3 is defaulting to Wayland because the requisite protocols have been merged, but it would be nice to have confirmation.
SDL3 defaults to Wayland if the currently running compositor supports fifo-v1: https://github.com/libsdl-org/SDL/commit/ab916a959e096a3af9502b50a622eda0e8f83253 + https://github.com/libsdl-org/SDL/commit/313d522f39c5b6aa9fa3498d41c75c7d560250da
fifo-v1 compositor status: https://wayland.app/protocols/fifo-v1#compositor-support
keep in mind that the status pages only track stable releases. the protocol has already been merged for Gnome 48 for example.
Last edited by Mershl on 23 Jan 2025 at 12:39 am UTC
SDL3 defaults to Wayland if the currently running compositor supports fifo-v1: https://github.com/libsdl-org/SDL/commit/ab916a959e096a3af9502b50a622eda0e8f83253 + https://github.com/libsdl-org/SDL/commit/313d522f39c5b6aa9fa3498d41c75c7d560250da
fifo-v1 compositor status: https://wayland.app/protocols/fifo-v1#compositor-support
keep in mind that the status pages only track stable releases. the protocol has already been merged for Gnome 48 for example.
Last edited by Mershl on 23 Jan 2025 at 12:39 am UTC
0 Likes
If SDL3 gets added to Fedora's repos
$ sudo dnf list SDL3*
Updating and loading repositories:
Repositories loaded.
Available packages
SDL3.i686 3.2.0-1.fc41 updates
SDL3.x86_64 3.2.0-1.fc41 updates
SDL3-devel.i686 3.2.0-1.fc41 updates
SDL3-devel.x86_64 3.2.0-1.fc41 updates
SDL3-static.i686 3.2.0-1.fc41 updates
SDL3-static.x86_64 3.2.0-1.fc41 updates
SDL3-test.x86_64 3.2.0-1.fc41 updates
1 Likes, Who?
The updated documentation certainly looks a lot better.
0 Likes
See more from me