sdl3-main

Crates.iosdl3-main
lib.rssdl3-main
version0.6.0
created_at2024-11-17 00:11:44.393761+00
updated_at2026-01-01 16:37:12.06307+00
descriptionTools for using SDL's main and callback APIs
homepage
repositoryhttps://codeberg.org/maia/sdl3-sys-rs
max_upload_size
id1450739
size105,975
Lokathor (Lokathor)

documentation

https://docs.rs/sdl3-main

README

sdl3-main

This crate provides tools for using SDL 3's main and callback APIs, and for interfacing with the main thread of the process.

SDL main

To provide your own main but call it through SDL, use the main attribute macro. See the documentation for that for more information.

Callback API

To use the SDL callback API, you can use either the app_impl attribute macro, or all four of the app_init, app_iterate, app_event and app_quit attribute macros. Don't use the main attribute macro in this mode. See the documentation for more information.

Main thread helpers

Some SDL functions have to be called on the main thread of the process. This crate provides some helper types and functions to alleviate this.

Features

Feature Description
alloc Enable features that require allocation (enabled by default)
std Enable features that require the standard library (enabled by default)
nightly Enable the ? operator to convert Result::Err and Option::None to AppResult*::Failure
use-parking-lot-v0-12 Support parking_lot 0.12 locks in app state accessors

Recent changes

  • 0.6.0:
    • Update sdl3-sys to 0.6.0
    • MainThreadToken::init() is no longer necessary in most cases
    • Pass arguments to main on std (!std already did)
    • Add MainThreadData::assert_new/get/get_mut
    • Log error when converting to AppResult*

See ChangeLog.md for older changes

Commit count: 866

cargo fmt