4 Initialization
Before using any SDL3 functions, the library must be initialized. The safe API provides both syntax forms and procedural functions.
4.1 Initialization Syntax
syntax
(with-sdl maybe-flags body ...)
maybe-flags =
| #:flags flags
flags : (or/c symbol? (listof symbol?))
'video —
Video subsystem (default) 'audio —
Audio subsystem 'events —
Events subsystem 'joystick —
Joystick subsystem 'gamepad —
Gamepad subsystem 'camera —
Camera subsystem
(with-sdl (displayln "SDL is ready!") ;; ... your SDL code here ... ) (with-sdl #:flags '(video audio) ;; Both video and audio are available )
4.2 Initialization Functions
flags can be a single symbol or a list of symbols. See with-sdl for available flags.
(sdl-init!) ; Initialize video only (sdl-init! 'audio) ; Initialize audio only (sdl-init! '(video audio)) ; Initialize both
procedure
(sdl-was-init [flags]) → exact-nonnegative-integer?
flags : exact-nonnegative-integer? = 0
procedure
(error-message) → string?
4.3 Application Metadata
procedure
(set-app-metadata! name version identifier) → void?
name : string? version : string? identifier : string?
name —
Human-readable application name version —
Version string (e.g., "1.0.0") identifier —
Unique identifier (e.g., "com.example.myapp")
procedure
(set-app-metadata-property! name value) → void?
name : string? value : string?
procedure
(get-app-metadata-property name) → (or/c string? #f)
name : string?