52 lines
1.4 KiB
Scheme
52 lines
1.4 KiB
Scheme
(import (scheme)
|
|
(chicken base)
|
|
(chicken foreign)
|
|
(sdl internal utilities))
|
|
(import-for-syntax (sdl3 internal utilities))
|
|
|
|
(foreign-declare "#include <SDL3/SDL_init.h>")
|
|
|
|
;;; Types
|
|
|
|
(define-foreign-type SDL_InitFlags unsigned-int32)
|
|
(define-foreign-type SDL_AppResult (enum "SDL_AppResult"))
|
|
|
|
;;; Constants
|
|
|
|
(define-sdl-const-values
|
|
init SDL_InitFlags
|
|
(audio video joystick haptic gamepad events sensor camera))
|
|
|
|
(define-sdl-const-values
|
|
app SDL_AppResult
|
|
(continue success failure))
|
|
|
|
;;; Procedures
|
|
|
|
(define (init #!rest flags)
|
|
((foreign-lambda bool "SDL_Init" SDL_InitFlags)
|
|
(foldl-uint-flags flags)))
|
|
|
|
(define (init-sub-system #!rest flags)
|
|
((foreign-lambda bool "SDL_InitSubSystem" SDL_InitFlags)
|
|
(foldl-uint-flags flags)))
|
|
|
|
(define quit
|
|
(foreign-lambda void "SDL_Quit" void))
|
|
|
|
(define (quit-sub-system #!rest flags)
|
|
((foreign-lambda void "SDL_QuitSubSystem" SDL_InitFlags)
|
|
(foldl-uint-flags 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 SDL_InitFlags "SDL_WasInit" SDL_InitFlags)
|
|
(foldl-uint-flags flags)))
|