module

Tryst::SDL

SDL3 rendering, audio and input for tryst. A separate shard so that tryst itself never grows an SDL dependency: nothing here is reachable from a plain require "tryst".

Class methods

audio_driver

The backend .audio_driver= last forced, or nil if nothing has. Not necessarily what SDL is actually using yet - see AudioStream.driver_name for the backend a live subsystem picked.

Source
audio_driver=(name : String | Nil) : Nil

Selects which audio backend .init(Subsystem::Audio) picks - e.g. "dummy" for a real device that silently discards every sample (what a test suite wants), or a real backend name ("coreaudio", "pulseaudio", ...) to force one explicitly. nil to stop forcing anything and let SDL choose on its own.

Backed by the SDL_AUDIO_DRIVER environment variable rather than SDL_SetHint, which looks like the more obvious API and does not survive: #quit clears every hint, but SDL re-reads the environment on each #init - the only setting of the two that a repeated init/quit cycle (what a test suite does) cannot undo out from under you. Must be set before the first #init(Subsystem::Audio) in the process; SDL only reads it while choosing a backend, so calling this after audio is already up has no effect until the next full #quit.

Source
init(subsystems : Subsystem) : Nil

Brings up subsystems, raising rather than returning a bool - there is nothing a caller can do with a failed init except stop. Safe to call repeatedly: SDL reference-counts subsystems, so a second init of an already-live one succeeds and adds a count.

Source
initialized

Everything currently up, as flags. Subsystems SDL brought up implicitly are included, so asking for Audio also reports Events.

Source
last_error

SDL's message for the most recent failing call. Empty when SDL has nothing to say - it is only meaningful right after a call that actually reported failure, never as a way to ask "did that work?".

Source
quit

Shuts down every subsystem regardless of how many times each was initialized - SDL_Quit is the big hammer, not a matching decrement.

Source
quit_subsystem(subsystems : Subsystem) : Nil

Shuts down only subsystems, leaving everything else running - the counterpart to #init when the big #quit hammer would be too broad (Gamepad.shutdown_subsystem, for one, must not tear down audio or video another part of the same program still has up).

Source
version

The SDL3 core library actually loaded into this process.

Source

Nested types