sdl3/lib/sdl3-init-impl.scm

44 lines
1.6 KiB
Scheme
Raw Normal View History

2024-09-22 21:46:26 +00:00
(import (scheme)
(chicken base)
(chicken bitwise)
(chicken foreign))
(foreign-declare "#include <SDL3/SDL_init.h>")
(define init-audio (foreign-value "SDL_INIT_AUDIO" unsigned-int32))
(define init-video (foreign-value "SDL_INIT_VIDEO" unsigned-int32))
(define init-joystick (foreign-value "SDL_INIT_JOYSTICK" unsigned-int32))
(define init-haptic (foreign-value "SDL_INIT_HAPTIC" unsigned-int32))
(define init-gamepad (foreign-value "SDL_INIT_GAMEPAD" unsigned-int32))
(define init-events (foreign-value "SDL_INIT_EVENTS" unsigned-int32))
(define init-sensor (foreign-value "SDL_INIT_SENSOR" unsigned-int32))
(define init-camera (foreign-value "SDL_INIT_CAMERA" unsigned-int32))
(define (init #!rest flags)
((foreign-lambda bool "SDL_Init" unsigned-int32)
(foldl bitwise-ior (car flags) (cdr flags))))
(define (init-sub-system #!rest flags)
((foreign-lambda bool "SDL_InitSubSystem" unsigned-int32)
(foldl bitwise-ior (car flags) (cdr flags))))
(define quit
(foreign-lambda void "SDL_Quit" void))
(define (quit-sub-system #!rest flags)
((foreign-lambda void "SDL_QuitSubSystem" unsigned-int32)
(foldl bitwise-ior (car flags) (cdr flags))))
(define set-app-metadata
(foreign-lambda bool "SDL_SetAppMetadata" c-string c-string c-string))
(define set-app-metadata-property
(foreign-lambda bool "SDL_SetAppMetadataProperty" c-string c-string))
(define get-app-metadata-property
(foreign-lambda c-string "SDL_GetAppMetadataProperty" c-string))
(define (was-init #!rest flags)
((foreign-lambda unsigned-int32 "SDL_WasInit" unsigned-int32)
(foldl bitwise-ior (car flags) (cdr flags))))