28 releases

new 0.11.10 Dec 14, 2024
0.11.6 Nov 29, 2024
0.5.0 Sep 11, 2023
0.4.0 Jun 5, 2023

#12 in Rendering

Download history 5/week @ 2024-08-24 9/week @ 2024-08-31 14/week @ 2024-09-07 9/week @ 2024-09-14 22/week @ 2024-09-21 53/week @ 2024-09-28 15/week @ 2024-10-05 34/week @ 2024-10-12 933/week @ 2024-10-19 372/week @ 2024-10-26 319/week @ 2024-11-02 134/week @ 2024-11-09 47/week @ 2024-11-16 600/week @ 2024-11-23 356/week @ 2024-11-30 490/week @ 2024-12-07

1,514 downloads per month
Used in 3 crates

MIT license

760KB
16K SLoC

SDL3 Crates.io Version

Bindings for SDL3 in Rust.

SDL is the Simple Directmedia Library, a cross-platform library to abstract the platform-specific details for building applications. It takes care of everything from handling events, creating windows, playing audio, accessing device cameras and sensors, locking, GPU access, and much more. See more here: https://wiki.libsdl.org/SDL3/APIByCategory.

SDL officially supports Windows, macOS, Linux, iOS, and Android, and several other platforms.

Migration Progress

Now that the SDL3 API is mostly stabilized, we are working on a new version of the Rust bindings for SDL3. The migration is in progress, and we are looking for contributors to help us complete it.

Expect some bugs and missing features. Feel free to create issues or work on them yourself.

Please refer to the sdl3-rs repository for the latest updates.

The low-level bindings are being worked on in the sdl3-sys repository.

Overview

This is an interface to use SDL3 from Rust.

Low-level C components are wrapped in Rust code to make them more idiomatic and abstract away inappropriate manual memory management.

Quick Start

Add the following to your Cargo.toml:

[dependencies]
sdl3 = { version = "0", features = [] }

Linking to SDL3

This crate requires the SDL3 system library to link and run.

By default without any of these features enabled, it will try to link a system SDL3 library as a dynamic/shared library using the default library search paths.

You may select how to link the library via features:

  • build-from-source: Fetch and build the library from source. Recommended if you just want it to work and don't have SDL3 installed system-wide.
  • build-from-source-static: Fetch and build the library from source and link it statically.
  • use-pkg-config: Use pkg-config to find the library.
  • use-vcpkg: Use vcpkg to find the library.
  • static-link: Link the library statically.
  • link-framework: Link the library as a framework on macOS.

You can read more about these options here.

Documentation

Contributing

We're looking for people to help get SDL3 support in Rust built, tested, and completed. You can help out!

Many examples and documentation requires updating. Interfaces have changed from SDL2 to SDL3, and the Rust bindings need to be updated to reflect these changes.

If you see anything wrong, missing, or suboptimal, please feel free to open a PR with your improvements.

If you would like to discuss ideas or ask questions, join the #rust channel on Discord.

History

This project was forked from Rust-sdl2 and the SDL2 code migrated to SDL3 according to the SDL2->SDL3 migration guide.

If you want a library compatible with earlier versions of SDL, please see Rust-sdl2.

Screenshots

Screenshot 2024-10-22 at 1 13 20 PM

Dependencies

~2.5MB
~24K SLoC