2024-09-22 21:46:26 +00:00
|
|
|
(import (scheme)
|
|
|
|
(chicken base)
|
2024-09-28 00:46:33 +00:00
|
|
|
(chicken foreign)
|
2024-10-08 22:41:17 +00:00
|
|
|
(sdl3 internal utilities))
|
2024-09-28 00:46:33 +00:00
|
|
|
(import-for-syntax (sdl3 internal utilities))
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(foreign-declare "#include <SDL3/SDL_init.h>")
|
|
|
|
|
2024-09-28 00:46:33 +00:00
|
|
|
;;; Types
|
|
|
|
|
|
|
|
(define-foreign-type SDL_InitFlags unsigned-int32)
|
|
|
|
(define-foreign-type SDL_AppResult (enum "SDL_AppResult"))
|
|
|
|
|
|
|
|
;;; Constants
|
|
|
|
|
|
|
|
(define-sdl-const-values
|
|
|
|
init SDL_InitFlags
|
2024-10-08 22:41:17 +00:00
|
|
|
audio video joystick haptic gamepad events sensor camera)
|
2024-09-28 00:46:33 +00:00
|
|
|
|
|
|
|
(define-sdl-const-values
|
|
|
|
app SDL_AppResult
|
2024-10-08 22:41:17 +00:00
|
|
|
continue success failure)
|
2024-09-28 00:46:33 +00:00
|
|
|
|
|
|
|
;;; Procedures
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(define (init #!rest flags)
|
2024-09-28 00:46:33 +00:00
|
|
|
((foreign-lambda bool "SDL_Init" SDL_InitFlags)
|
|
|
|
(foldl-uint-flags flags)))
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(define (init-sub-system #!rest flags)
|
2024-09-28 00:46:33 +00:00
|
|
|
((foreign-lambda bool "SDL_InitSubSystem" SDL_InitFlags)
|
|
|
|
(foldl-uint-flags flags)))
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(define quit
|
2024-10-08 22:41:17 +00:00
|
|
|
(foreign-lambda void "SDL_Quit"))
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(define (quit-sub-system #!rest flags)
|
2024-09-28 00:46:33 +00:00
|
|
|
((foreign-lambda void "SDL_QuitSubSystem" SDL_InitFlags)
|
|
|
|
(foldl-uint-flags flags)))
|
2024-09-22 21:46:26 +00:00
|
|
|
|
|
|
|
(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)
|
2024-09-28 00:46:33 +00:00
|
|
|
((foreign-lambda SDL_InitFlags "SDL_WasInit" SDL_InitFlags)
|
|
|
|
(foldl-uint-flags flags)))
|