sdl3/lib/sdl3-init-impl.scm

54 lines
1.4 KiB
Scheme
Raw Normal View History

2024-09-22 21:46:26 +00:00
(import (scheme)
(chicken base)
(chicken bitwise)
2024-09-28 00:46:33 +00:00
(chicken foreign)
(sdl internal utilities))
(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
(audio video joystick haptic gamepad events sensor camera))
(define-sdl-const-values
app SDL_AppResult
(continue success failure))
;;; 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
(foreign-lambda void "SDL_Quit" void))
(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)))