It compiles

This commit is contained in:
Daniel Ziltener 2024-10-09 00:41:17 +02:00
parent 11f51a2dac
commit 17e10b4c4f
Signed by: zilti
GPG key ID: B38976E82C9DAE42
19 changed files with 273 additions and 231 deletions

2
.gitignore vendored
View file

@ -4,5 +4,7 @@
*.o *.o
*.so *.so
*.c *.c
*.link
*.c.tmp.*
.direnv/ .direnv/

View file

@ -3,8 +3,10 @@
(chicken bitwise) (chicken bitwise)
(chicken syntax) (chicken syntax)
(srfi 152)) (srfi 152))
(import-for-syntax (format)
(srfi 152))
(define (snake-upcase in) (define-for-syntax (snake-upcase in)
(string-map (lambda (c) (string-map (lambda (c)
(if (char=? #\- c) (if (char=? #\- c)
#\_ #\_
@ -56,4 +58,4 @@
"~A(~{~^, ~};" ())) "~A(~{~^, ~};" ()))
((_ return-type proc (args ...)) ((_ return-type proc (args ...))
(call-c* return-type proc (args ...) (call-c* return-type proc (args ...)
"C_return(~A(~{~^, ~}));")))) "C_return(~A(~{~^, ~}));" ()))))

View file

@ -0,0 +1,11 @@
(import (scheme)
(chicken base)
(chicken foreign))
(import-syntax (sdl3 internal utilities))
(foreign-declare "#include <SDL3/SDL_blendmode.h>")
(define-sdl-const-values
blendmode unsigned-int32
none blend blend-premultiplied add add add-premultiplied
mod mul invalid)

7
lib/sdl3-events-impl.scm Normal file
View file

@ -0,0 +1,7 @@
(import (scheme)
(chicken base)
(chicken foreign))
(foreign-declare "#include <SDL3/SDL_events.h>")
(define-foreign-type SDL_Event (union "SDL_Event"))

View file

@ -1,7 +1,7 @@
(import (scheme) (import (scheme)
(chicken base) (chicken base)
(chicken foreign) (chicken foreign)
(sdl internal utilities)) (sdl3 internal utilities))
(import-for-syntax (sdl3 internal utilities)) (import-for-syntax (sdl3 internal utilities))
(foreign-declare "#include <SDL3/SDL_init.h>") (foreign-declare "#include <SDL3/SDL_init.h>")
@ -15,11 +15,11 @@
(define-sdl-const-values (define-sdl-const-values
init SDL_InitFlags init SDL_InitFlags
(audio video joystick haptic gamepad events sensor camera)) audio video joystick haptic gamepad events sensor camera)
(define-sdl-const-values (define-sdl-const-values
app SDL_AppResult app SDL_AppResult
(continue success failure)) continue success failure)
;;; Procedures ;;; Procedures
@ -32,7 +32,7 @@
(foldl-uint-flags flags))) (foldl-uint-flags flags)))
(define quit (define quit
(foreign-lambda void "SDL_Quit" void)) (foreign-lambda void "SDL_Quit"))
(define (quit-sub-system #!rest flags) (define (quit-sub-system #!rest flags)
((foreign-lambda void "SDL_QuitSubSystem" SDL_InitFlags) ((foreign-lambda void "SDL_QuitSubSystem" SDL_InitFlags)

19
lib/sdl3-pixels-impl.scm Normal file
View file

@ -0,0 +1,19 @@
(import (scheme)
(chicken base)
(chicken foreign))
(import-syntax (sdl3 internal utilities))
(foreign-declare "#include <SDL3/SDL_pixels.h>")
(define-sdl-const-values
pixelformat unsigned-int32
unknown index1lsb index1msb index2lsb index2msb index4lsb index4msb index8 rgb332
xrgb4444 xbgr4444 xrgb1555 xbgr1555 argb4444 rgba4444 abgr4444 bgra4444 argb1555
rgba5551 abgr1555 bgra5551 rgb565 bgr565 rgb24 bgr24 xrgb8888 rgbx8888
xbgr8888 bgrx8888 argb8888 rgba8888 abgr8888 bgra8888
xrgb2101010 xbgr2101010 argb2101010 abgr2101010 rgb48 bgr48 rgba64
argb64 bgra64 abgr64 rgb48-float bgr48-float rgba64-float argb64-float
bgra64-float abgr64-float rgb96-float bgr96-float rgba128-float
argb128-float bgra128-float abgr128-float yv12 iyuv yuy2 uyvy yvyu nv12
nv21 p010 external-oes rgba32 argb32 bgra32 abgr32 rgbx32 xrgb32 bgrx32
xbgr32)

View file

@ -1,7 +1,7 @@
(import (scheme) (import (scheme)
(chicken base) (chicken base)
(chicken foreign)) (chicken foreign))
(import-for-syntax (sdl3 internal utilities)) (import-syntax (sdl3 internal utilities))
(foreign-declare "#include <SDL3/SDL_render.h>") (foreign-declare "#include <SDL3/SDL_render.h>")
@ -13,7 +13,7 @@
(define convert-event-to-render-coordinates (define convert-event-to-render-coordinates
(foreign-lambda bool "SDL_ConvertEventToRenderCoordinates" (foreign-lambda bool "SDL_ConvertEventToRenderCoordinates"
(c-pointer (struct "SDL_Renderer")) (c-pointer (struct "SDL_Renderer"))
(c-pointer (struct "SDL_Event")))) (c-pointer (union "SDL_Event"))))
(define create-renderer (define create-renderer
(foreign-lambda (c-pointer (struct "SDL_Renderer")) (foreign-lambda (c-pointer (struct "SDL_Renderer"))
@ -31,9 +31,9 @@
"SDL_CreateSoftwareRenderer" "SDL_CreateSoftwareRenderer"
(c-pointer (struct "SDL_Surface")))) (c-pointer (struct "SDL_Surface"))))
(define-sdl-enum-values (define-sdl-const-values
textureaccess int textureaccess int
(static streaming target)) static streaming target)
(define create-texture (define create-texture
(foreign-lambda (c-pointer (struct "SDL_Texture")) (foreign-lambda (c-pointer (struct "SDL_Texture"))
@ -219,9 +219,9 @@
float float float float float float float float float float
(c-pointer (struct "SDL_FRect")))) (c-pointer (struct "SDL_FRect"))))
(define-sdl-enum-values (define-sdl-const-values
flip int flip int
(none horizontal vertical)) none horizontal vertical)
(define render-texture-rotated (define render-texture-rotated
(foreign-lambda bool "SDL_RenderTextureRotated" (foreign-lambda bool "SDL_RenderTextureRotated"
@ -255,11 +255,6 @@
(c-pointer (struct "SDL_Renderer")) (c-pointer (struct "SDL_Renderer"))
float)) float))
(define-sdl-enum-values
blendmode unsigned-int32
(none blend blend-premultiplied add add premultiplied
mod nul invalid))
(define set-render-draw-blend-mode (define set-render-draw-blend-mode
(foreign-lambda bool "SDL_SetRenderDrawBlendMode" (foreign-lambda bool "SDL_SetRenderDrawBlendMode"
(c-pointer (struct "SDL_Renderer")) (c-pointer (struct "SDL_Renderer"))
@ -275,13 +270,13 @@
(c-pointer (struct "SDL_Renderer")) (c-pointer (struct "SDL_Renderer"))
float float float float)) float float float float))
(define-sdl-enum-values (define-sdl-const-values
logical-presentation int logical-presentation int
(disabled stretch letterbox overscan integer-scale)) disabled stretch letterbox overscan integer-scale)
(define-sdl-enum-values (define-sdl-const-values
scalemode int scalemode int
(nearest linear)) nearest linear)
(define set-render-logical-presentation (define set-render-logical-presentation
(foreign-lambda bool "SDL_SetRenderLogicalPresentation" (foreign-lambda bool "SDL_SetRenderLogicalPresentation"
@ -305,9 +300,9 @@
(c-pointer (struct "SDL_Renderer")) (c-pointer (struct "SDL_Renderer"))
(c-pointer (struct "SDL_Rect")))) (c-pointer (struct "SDL_Rect"))))
(define-sdl-enum-values (define-sdl-const-values
renderer-vsync int renderer-vsync int
(disabled adaptive)) disabled adaptive)
(define set-render-vsync (define set-render-vsync
(foreign-lambda bool "SDL_SetRenderVSync" (foreign-lambda bool "SDL_SetRenderVSync"
@ -345,7 +340,7 @@
(enum "SDL_ScaleMode"))) (enum "SDL_ScaleMode")))
(define unlock-texture (define unlock-texture
(foreign-lambda bool "SDL_UnlockTexture" (c-pointer (struct "SDL_Texture")))) (foreign-lambda void "SDL_UnlockTexture" (c-pointer (struct "SDL_Texture"))))
;; TODO: SDL_UpdateNVTexture ;; TODO: SDL_UpdateNVTexture

View file

@ -1,7 +1,7 @@
(import (scheme) (import (scheme)
(chicken base) (chicken base)
(chicken foreign)) (chicken foreign))
(import-for-syntax (sdl3 internal utilities)) (import-syntax (sdl3 internal utilities))
(foreign-declare "#include <SDL3/SDL_video.h>") (foreign-declare "#include <SDL3/SDL_video.h>")
@ -13,7 +13,7 @@
(define-foreign-type SDL_EGLAttribArrayCallback (define-foreign-type SDL_EGLAttribArrayCallback
(function SDL_EGLAttrib () "SDLCALL")) (function SDL_EGLAttrib () "SDLCALL"))
(define-foreign-type SDL_EGLDisplay c-pointer) (define-foreign-type SDL_EGLDisplay c-pointer)
(define-foreign-type SDL_GLContext (struct "SDL_GLContext")) (define-foreign-type SDL_GLContext (c-pointer (struct "SDL_GLContextState")))
(define-foreign-type SDL_HitTest (define-foreign-type SDL_HitTest
(function SDL_HitTestResult ((c-pointer SDL_Window) (c-pointer SDL_Point) c-pointer))) (function SDL_HitTestResult ((c-pointer SDL_Window) (c-pointer SDL_Point) c-pointer)))
(define-foreign-type SDL_Window (struct "SDL_Window")) (define-foreign-type SDL_Window (struct "SDL_Window"))
@ -24,96 +24,83 @@
(define-foreign-type SDL_DisplayOrientation (enum "SDL_DisplayOrientation")) (define-foreign-type SDL_DisplayOrientation (enum "SDL_DisplayOrientation"))
(define-sdl-const-values (define-sdl-const-values
orientation SDL_DisplayOrientation orientation SDL_DisplayOrientation
(unknown landscape landscape-flipped portrait portrait-flipped)) unknown landscape landscape-flipped portrait portrait-flipped)
(define-foreign-type SDL_FlashOperation (enum "SDL_FlashOperation")) (define-foreign-type SDL_FlashOperation (enum "SDL_FlashOperation"))
(define-sdl-const-values (define-sdl-const-values
flash SDL_FlashOperation flash SDL_FlashOperation
(cancel briefly until-focused)) cancel briefly until-focused)
(define-foreign-type SDL_GLattr (enum "SDL_GLattr")) (define-foreign-type SDL_GLattr (enum "SDL_GLattr"))
(define-sdl-const-values (define-sdl-const-values
(gl SDL_GLattr gl SDL_GLattr
red-size green-size blue-size alpha-size buffer-size doublebuffer depth-size red-size green-size blue-size alpha-size buffer-size doublebuffer depth-size
stencil-size accum-red-size accum-green-size accum-blue-size accum-alpha-size stencil-size accum-red-size accum-green-size accum-blue-size accum-alpha-size
stereo multisamplebuffers multisamplesamples accelerated-visual retained-backing stereo multisamplebuffers multisamplesamples accelerated-visual retained-backing
context-major-version context-minor-version context-flags context-profile-mask context-major-version context-minor-version context-flags context-profile-mask
share-with-current-context framebuffer-srgb-capable context-release-behavior share-with-current-context framebuffer-srgb-capable context-release-behavior
context-reset-notification context-no-error floatbuffers egl-platform)) context-reset-notification context-no-error floatbuffers egl-platform)
(define-foreign-type SDL_GLcontextFlag (enum "SDL_GLcontextFlag")) (define-foreign-type SDL_GLcontextFlag (enum "SDL_GLcontextFlag"))
(define-sdl-const-values (define-sdl-const-values
gl-context SDL_GLcontextFlag gl-context SDL_GLcontextFlag
(debug-flag forward-compatible-flag robust-access-flag reset-isolation-flag)) debug-flag forward-compatible-flag robust-access-flag reset-isolation-flag)
(define-foreign-type SDL_GLcontextReleaseFlag (enum "SDL_GLcontextReleaseFlag")) (define-foreign-type SDL_GLcontextReleaseFlag (enum "SDL_GLcontextReleaseFlag"))
(define-sdl-const-values (define-sdl-const-values
gl-context-release-behavior SDL_GLcontestReleaseFlag gl-context-release-behavior SDL_GLcontextReleaseFlag
(none flush)) none flush)
(define-foreign-type SDL_GLContextResetNotification (enum "SDL_GLContextResetNotification")) (define-foreign-type SDL_GLContextResetNotification (enum "SDL_GLContextResetNotification"))
(define-sdl-const-values (define-sdl-const-values
gl-context-reset SDL_GLContextResetNotification gl-context-reset SDL_GLContextResetNotification
(no-notification lose-context)) no-notification lose-context)
(define-foreign-type SDL_GLprofile (enum "SDL_GLprofile")) (define-foreign-type SDL_GLprofile (enum "SDL_GLprofile"))
(define-sdl-const-values (define-sdl-const-values
gl-context-profile SDL_GLprofile gl-context-profile SDL_GLprofile
(core compatibility es)) core compatibility es)
(define-foreign-type SDL_HitTestResult (enum "SDL_HitTestResult")) (define-foreign-type SDL_HitTestResult (enum "SDL_HitTestResult"))
(define-sdl-const-values (define-sdl-const-values
hittest SDL_HitTestResult hittest SDL_HitTestResult
(normal draggable resize-topleft resize-top resize-topright resize-right normal draggable resize-topleft resize-top resize-topright resize-right
resize-bottomright resize-bottom resize-bottomleft resize-left)) resize-bottomright resize-bottom resize-bottomleft resize-left)
(define-foreign-type SDL_SystemTheme (enum "SDL_SystemTheme")) (define-foreign-type SDL_SystemTheme (enum "SDL_SystemTheme"))
(define-sdl-const-values (define-sdl-const-values
system-theme SDL_SystemTheme system-theme SDL_SystemTheme
(unknown light dark)) unknown light dark)
(define-foreign-type SDL_WindowFlags unsigned-int64) (define-foreign-type SDL_WindowFlags unsigned-integer64)
(define-sdl-const-values (define-sdl-const-values
window SDL_WindowFlags window SDL_WindowFlags
(fullscreen opengl occluded hidden borderless resizable minimized maximized fullscreen opengl occluded hidden borderless resizable minimized maximized
mouse-grabbed input-focus mouse-focus external modal high-pixel-density mouse-grabbed input-focus mouse-focus external modal high-pixel-density
mouse-capture mouse-relative-mode always-on-top utility tooltip popup-menu mouse-capture mouse-relative-mode always-on-top utility tooltip popup-menu
keyboard-grabbed vulkan metal transparent not-focusable)) keyboard-grabbed vulkan metal transparent not-focusable)
;; These are weird string properties for CreateWindowWithProperties ;; These are weird string properties for CreateWindowWithProperties
(define-sdl-const-values (define-sdl-const-values
prop-window-create c-string prop-window-create c-string
(always-on-top-boolean borderless-boolean external-graphics-context-boolean always-on-top-boolean borderless-boolean external-graphics-context-boolean
focusable-boolean fullscreen-boolean height-number hidden-boolean focusable-boolean fullscreen-boolean height-number hidden-boolean
high-pixel-density-boolean maximized-boolean menu-boolean high-pixel-density-boolean maximized-boolean menu-boolean
metal-boolean minimized-boolean modal-boolean metal-boolean minimized-boolean modal-boolean
mouse-grabbed-boolean opengl-boolean parent-pointer mouse-grabbed-boolean opengl-boolean parent-pointer
resizable-boolean title-string transparent-boolean tooltip-boolean resizable-boolean title-string transparent-boolean tooltip-boolean
utility-boolean vulkan-boolean width-number x-number y-number utility-boolean vulkan-boolean width-number x-number y-number
cocoa-window-pointer cocoa-view-pointer cocoa-window-pointer cocoa-view-pointer
wayland-surface-role-custom-boolean wayland-surface-role-custom-boolean
wayland-create-egl-window-boolean wayland-wl-surface-pointer wayland-create-egl-window-boolean wayland-wl-surface-pointer
win32-hwnd-pointer win32-pixel-format-hwnd-pointer win32-hwnd-pointer win32-pixel-format-hwnd-pointer
x11-window-number)) x11-window-number)
(define-sdl-const-values
pixelformat unsigned-int32
(unknown index1lsb index1msb index2lsb index2msb index4lsb index4msb index8 rgb332
xrgb4444 xbgr4444 xrgb1555 xbgr1555 argb4444 rgba4444 abgr4444 bgra4444 argb1555
rgba5551 abgr1555 bgra5551 rgb565 bgr565 rgb24 bgr24 xrgb8888 rgbx8888
pixelformat-xbgr8888 pbgrx8888 pargb8888 prgba8888 pabgr8888 pbgra8888
pxrgb2101010 pxbgr2101010 pargb2101010 pabgr2101010 prgb48 pbgr48 prgba64
pargb64 pbgra64 pabgr64 prgb48-float pbgr48-float prgba64-float pargb64-float
pbgra64-float pabgr64-float prgb96-float pbgr96-float prgba128-float
pargb128-float pbgra128-float pabgr128-float pyv12 piyuv pyuy2 puyvy pyvyu pnv12
pnv21 pp010 external-oes rgba32 argb32 bgra32 abgr32 rgbx32 xrgb32 bgrx32
xbgr32))
;;; Procedures ;;; Procedures
(define (create-popup-window parent offset-x offset-y w h #!rest flags) (define (create-popup-window parent offset-x offset-y w h #!rest flags)
((foreign-lambda (c-pointer SDL_Window) "SDL_CreatePopupWindow" ((foreign-lambda (c-pointer SDL_Window) "SDL_CreatePopupWindow"
(struct SDL_Window) int int int int unsigned-int64) (c-pointer SDL_Window) integer integer integer integer unsigned-integer64)
parent offset-x offset-y w h (foldl-uint-flags flags))) parent offset-x offset-y w h (foldl-uint-flags flags)))
(define (create-window title w h #!rest flags) (define (create-window title w h #!rest flags)
@ -124,7 +111,7 @@
;; TODO: SDL_CreateWindowWithProperties ;; TODO: SDL_CreateWindowWithProperties
(define destroy-window (define destroy-window
(call-c void SDL_DestroyWindow ((c-pointer SDL_Window)))) (foreign-lambda void "SDL_DestroyWindow" (c-pointer SDL_Window)))
(define destroy-window-surface (define destroy-window-surface
(foreign-lambda bool "SDL_DestroyWindowSurface" (c-pointer SDL_Window))) (foreign-lambda bool "SDL_DestroyWindowSurface" (c-pointer SDL_Window)))
@ -157,7 +144,7 @@
SDL_DisplayID int int float bool (c-pointer SDL_DisplayMode))) SDL_DisplayID int int float bool (c-pointer SDL_DisplayMode)))
(define get-current-display-mode (define get-current-display-mode
(foreign-lambda (c-pointer SDL_DisplayMode) "SDL_DisplayMode" SDL_DisplayID)) (foreign-lambda (c-pointer SDL_DisplayMode) "SDL_GetCurrentDisplayMode" SDL_DisplayID))
(define get-current-display-orientation (define get-current-display-orientation
(foreign-lambda SDL_DisplayOrientation "SDL_GetCurrentDisplayOrientation" (foreign-lambda SDL_DisplayOrientation "SDL_GetCurrentDisplayOrientation"
@ -207,17 +194,14 @@
(foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GetGrabbedWindow")) (foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GetGrabbedWindow"))
(define get-natural-display-orientation (define get-natural-display-orientation
(foreign-lambda (enum "SDL_DisplayOrientation" unsigned-int32))) (foreign-lambda (enum "SDL_DisplayOrientation")
"SDL_GetNaturalDisplayOrientation" unsigned-int32))
(define get-num-video-drivers (define get-num-video-drivers
(foreign-lambda int "SDL_GetNumVideoDrivers")) (foreign-lambda int "SDL_GetNumVideoDrivers"))
(define get-primary-display (define get-primary-display
(foreign-lambda unsigned-int22 "SDL_GetPrimaryDisplay")) (foreign-lambda unsigned-int32 "SDL_GetPrimaryDisplay"))
(define-sdl-const-values
system-theme int
(unknown light dark))
(define get-system-theme (define get-system-theme
(foreign-lambda (enum "SDL_SystemTheme") "SDL_GetSystemTheme")) (foreign-lambda (enum "SDL_SystemTheme") "SDL_GetSystemTheme"))
@ -233,7 +217,7 @@
(foreign-lambda float "SDL_GetWindowDisplayScale" (c-pointer (struct "SDL_Window")))) (foreign-lambda float "SDL_GetWindowDisplayScale" (c-pointer (struct "SDL_Window"))))
(define get-window-flags (define get-window-flags
(foreign-lambda unsigned-int32 "SDL_GetWindowFlags" (c-pointer (c-struct "SDL_Window")))) (foreign-lambda unsigned-int32 "SDL_GetWindowFlags" (c-pointer (struct "SDL_Window"))))
(define get-window-from-id (define get-window-from-id
(foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GetWindowFromID" unsigned-int32)) (foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GetWindowFromID" unsigned-int32))
@ -248,7 +232,7 @@
(foreign-lambda unsigned-int32 "SDL_GetWindowID" (c-pointer (struct "SDL_Window")))) (foreign-lambda unsigned-int32 "SDL_GetWindowID" (c-pointer (struct "SDL_Window"))))
(define get-window-keyboard-grab (define get-window-keyboard-grab
(foreign-lambda bool "SDL_GetWindowKeywordGrab" (c-pointer (struct "SDL_Window")))) (foreign-lambda bool "SDL_GetWindowKeyboardGrab" (c-pointer (struct "SDL_Window"))))
;; TODO: SDL_GetWindowMaximumSize ;; TODO: SDL_GetWindowMaximumSize
@ -299,11 +283,11 @@
(foreign-lambda c-string "SDL_GetWindowTitle" (c-pointer (struct "SDL_Window")))) (foreign-lambda c-string "SDL_GetWindowTitle" (c-pointer (struct "SDL_Window"))))
(define gl-create-context (define gl-create-context
(foreign-lambda (struct "SDL_GLContext") "SDL_GL_CreateContext" (foreign-lambda (c-pointer (struct "SDL_GLContextState")) "SDL_GL_CreateContext"
(c-pointer (struct "SDL_Window")))) (c-pointer (struct "SDL_Window"))))
(define gl-destroy-context (define gl-destroy-context
(foreign-lambda bool "SDL_GL_DestroyContext" (struct "SDL_GLContext"))) (foreign-lambda bool "SDL_GL_DestroyContext" (c-pointer (struct "SDL_GLContextState"))))
(define gl-extension-supported (define gl-extension-supported
(foreign-lambda bool "SDL_GL_ExtensionSupported" c-string)) (foreign-lambda bool "SDL_GL_ExtensionSupported" c-string))
@ -311,7 +295,7 @@
;; TODO: SDL_GL_GetAttribute ;; TODO: SDL_GL_GetAttribute
(define gl-get-current-context (define gl-get-current-context
(foreign-lambda (struct "SDL_GLContext") "SDL_GL_GetCurrentContext")) (foreign-lambda (c-pointer (struct "SDL_GLContextState")) "SDL_GL_GetCurrentContext"))
(define gl-get-current-window (define gl-get-current-window
(foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GL_GetCurrentWindow")) (foreign-lambda (c-pointer (struct "SDL_Window")) "SDL_GL_GetCurrentWindow"))
@ -326,7 +310,7 @@
(define gl-make-current (define gl-make-current
(foreign-lambda bool "SDL_GL_MakeCurrent" (foreign-lambda bool "SDL_GL_MakeCurrent"
(c-pointer (struct "SDL_Window")) (struct "SDL_GLContext"))) (c-pointer (struct "SDL_Window")) (c-pointer (struct "SDL_GLContextState"))))
(define gl-reset-attributes (define gl-reset-attributes
(foreign-lambda void "SDL_GL_ResetAttributes")) (foreign-lambda void "SDL_GL_ResetAttributes"))
@ -404,10 +388,10 @@
(define set-window-modal (define set-window-modal
(foreign-lambda bool "SDL_SetWindowModal" (c-pointer (struct "SDL_Window")) bool)) (foreign-lambda bool "SDL_SetWindowModal" (c-pointer (struct "SDL_Window")) bool))
(define set-window-modal-for ;; (define set-window-modal-for
(foreign-lambda bool "SDL_SetWindowModalFor" ;; (foreign-lambda bool "SDL_SetWindowModalFor"
(c-pointer (struct "SDL_Window")) ;; (c-pointer (struct "SDL_Window"))
(c-pointer (struct "SDL_Window")))) ;; (c-pointer (struct "SDL_Window"))))
(define set-window-mouse-grab (define set-window-mouse-grab
(foreign-lambda bool "SDL_SetWindowMouseGrab" (foreign-lambda bool "SDL_SetWindowMouseGrab"

6
sdl3.blendmode.scm Normal file
View file

@ -0,0 +1,6 @@
(define-library (sdl3 blendmode)
(export)
(import (scheme)
(chicken base))
(begin
(include-relative "lib/sdl3-blendmode-impl.scm")))

View file

@ -4,17 +4,24 @@
(category ui) (category ui)
(license "MIT") (license "MIT")
(version "0.1") (version "0.1")
(dependencies) (dependencies format srfi-152)
(test-dependencies) (test-dependencies)
(components (components
(extension sdl3.internal.utilities) (extension sdl3.internal.utilities)
(extension sdl3.features) (extension sdl3.features (custom-build "build-sdl3"))
(extension sdl3.pixels (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.blendmode (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.init (custom-build "build-sdl3") (extension sdl3.init (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities)) (component-dependencies sdl3.internal.utilities))
(extension sdl3.main (custom-build "build-sdl3") (extension sdl3.main (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities)) (component-dependencies sdl3.internal.utilities))
(extension sdl3.events (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.video (custom-build "build-sdl3") (extension sdl3.video (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities)) (component-dependencies sdl3.internal.utilities))
(extension sdl3.render (custom-build "build-sdl3") (extension sdl3.render (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities)))) (component-dependencies sdl3.internal.utilities
sdl3.events))))

6
sdl3.events.scm Normal file
View file

@ -0,0 +1,6 @@
(define-library (sdl3 events)
(export)
(import (scheme)
(chicken base))
(begin
(include-relative "lib/sdl3-events-impl.scm")))

View file

@ -1,5 +1,5 @@
(module (sdl3 features) (define-library (sdl3 features)
() (export)
(import (scheme) (import (scheme)
(chicken base) (chicken base)
(chicken foreign) (chicken foreign)

View file

@ -1,15 +1,12 @@
(module (sdl3 init) (define-library (sdl3 init)
(SDL_InitFlags (export init
SDL_AppResult init-sub-system
quit
init quit-sub-system
init-sub-system set-app-metadata
quit set-app-metadata-property
quit-sub-system get-app-metadata-property
set-app-metadata was-init)
set-app-metadata-property
get-app-metadata-property
was-init)
(import (scheme) (import (scheme)
(chicken base)) (chicken base))
(begin (begin

View file

@ -1,7 +1,7 @@
(module (sdl3 internal utilities) (define-library (sdl3 internal utilities)
(define-sdl-flag (export foldl-uint-flags
define-sdl-enum-values define-sdl-const-values
call-c) call-c)
(import (scheme) (import (scheme)
(chicken base)) (chicken base))
(begin (begin

View file

@ -1,5 +1,5 @@
(module (sdl3 main) (define-library (sdl3 main)
() (export)
(import (scheme) (import (scheme)
(chicken base)) (chicken base))
(begin (begin

6
sdl3.pixels.scm Normal file
View file

@ -0,0 +1,6 @@
(define-library (sdl3 pixels)
(export)
(import (scheme)
(chicken base))
(begin
(include-relative "lib/sdl3-pixels-impl.scm")))

View file

@ -1,5 +1,5 @@
(module (sdl3 render) (define-library (sdl3 render)
() (export)
(import (scheme) (import (scheme)
(chicken base)) (chicken base))
(begin (begin

View file

@ -1,114 +1,114 @@
(module (sdl3 video) (define-library (sdl3 video)
(create-popup-window (export create-popup-window
create-window create-window
create-window-with-properties ;; create-window-with-properties
destroy-window destroy-window
destroy-window-surface destroy-window-surface
disable-screen-saver disable-screen-saver
egl-get-current-config egl-get-current-config
egl-get-current-display egl-get-current-display
egl-get-proc-address egl-get-proc-address
egl-get-window-surface egl-get-window-surface
enable-screen-saver enable-screen-saver
flash-window flash-window
get-closest-fullscreen-display-mode get-closest-fullscreen-display-mode
get-current-display-mode get-current-display-mode
get-current-display-orientation get-current-display-orientation
get-current-video-driver get-current-video-driver
get-desktop-display-mode get-desktop-display-mode
get-display-bounds get-display-bounds
get-display-content-scale get-display-content-scale
get-display-for-point get-display-for-point
get-display-for-rect get-display-for-rect
get-display-for-window get-display-for-window
get-display-name get-display-name
get-display-properties get-display-properties
;; get-displays ;; get-displays
get-display-usable-bounds get-display-usable-bounds
;; get-fullscreen-display-modes ;; get-fullscreen-display-modes
get-grabbed-window get-grabbed-window
get-natural-display-orientation get-natural-display-orientation
get-num-video-drivers get-num-video-drivers
get-primary-display get-primary-display
get-system-theme get-system-theme
get-video-driver get-video-driver
;; get-window-aspect-ratio ;; get-window-aspect-ratio
;; get-window-borders-size ;; get-window-borders-size
get-window-display-scale get-window-display-scale
get-window-flags get-window-flags
get-window-from-id get-window-from-id
get-window-fullscreen-mode get-window-fullscreen-mode
;; get-window-icc-profile ;; get-window-icc-profile
get-window-id get-window-id
get-window-keyboard-grab get-window-keyboard-grab
;; get-window-maximum-size ;; get-window-maximum-size
;; get-window-minumum-size ;; get-window-minumum-size
get-window-mouse-grab get-window-mouse-grab
get-window-mouse-rect get-window-mouse-rect
get-window-opacity get-window-opacity
get-window-parent get-window-parent
get-window-pixel-density get-window-pixel-density
get-window-pixel-format get-window-pixel-format
;; get-window-position ;; get-window-position
get-window-properties get-window-properties
;; get-windows ;; get-windows
;; get-window-safe-area ;; get-window-safe-area
;; get-window-size ;; get-window-size
;; get-window-size-in-pixels ;; get-window-size-in-pixels
get-window-surface get-window-surface
;; get-window-surface-vsync ;; get-window-surface-vsync
get-window-title get-window-title
gl-create-context gl-create-context
gl-destroy-context gl-destroy-context
gl-extension-supported gl-extension-supported
;; gl-get-attribute ;; gl-get-attribute
gl-get-current-context gl-get-current-context
gl-get-current-window gl-get-current-window
gl-get-proc-address gl-get-proc-address
;; gl-get-swap-interval ;; gl-get-swap-interval
gl-load-library gl-load-library
gl-make-current gl-make-current
gl-reset-attributes gl-reset-attributes
gl-set-attribute gl-set-attribute
gl-set-swap-interval gl-set-swap-interval
gl-swap-window gl-swap-window
gl-unload-library gl-unload-library
hide-window hide-window
maximize-window maximize-window
minimize-window minimize-window
raise-window raise-window
restore-window restore-window
screen-saver-enabled screen-saver-enabled
set-window-always-on-top set-window-always-on-top
set-window-aspect-ratio set-window-aspect-ratio
set-window-bordered set-window-bordered
set-window-focusable set-window-focusable
set-window-fullscreen set-window-fullscreen
set-window-fullscreen-mode set-window-fullscreen-mode
;; set-window-hit-test ;; set-window-hit-test
set-window-icon set-window-icon
set-window-keyboard-grab set-window-keyboard-grab
set-window-maximum-size set-window-maximum-size
set-window-minimum-size set-window-minimum-size
set-window-modal set-window-modal
set-window-modal-for ;; set-window-modal-for
set-window-mouse-grab set-window-mouse-grab
set-window-mouse-rect set-window-mouse-rect
set-window-opacity set-window-opacity
set-window-parent set-window-parent
set-window-position set-window-position
set-window-resizable set-window-resizable
set-window-shape set-window-shape
set-window-size set-window-size
set-window-surface-vsync set-window-surface-vsync
set-window-title set-window-title
show-window show-window
show-window-system-menu show-window-system-menu
sync-window sync-window
update-window-surface update-window-surface
;; update-window-surface-rects ;; update-window-surface-rects
window-has-surface window-has-surface
) )
(import (scheme) (import (scheme)
(chicken base)) (chicken base))
(begin (begin

View file

@ -32,9 +32,9 @@ mkShell {
; ;
shellHook = '' shellHook = ''
export CC="${pkgs.tcc-mob}/bin/tcc" export CC="${pkgs.tcc-mob}/bin/tcc"
export CHICKEN_PREFIX="$(pwd)/.chicken" export CHICKEN_PREFIX="$HOME/.chicken"
export CHICKEN_INSTALL_REPOSITORY="$(pwd)/.chicken/eggs" export CHICKEN_INSTALL_REPOSITORY="$HOME/.chicken/eggs"
export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/12:$(pwd)/.chicken/eggs" export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/12:$HOME/.chicken/eggs"
export PATH="$PATH:$CHICKEN_PREFIX" export PATH="$PATH:$CHICKEN_PREFIX"
# chicken-install lsp-server salmonella # chicken-install lsp-server salmonella
export CHICKEN_PREFIX="${pkgs.chicken}" export CHICKEN_PREFIX="${pkgs.chicken}"