summaryrefslogtreecommitdiff
path: root/sdl2/bindings.scm
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-07-22 14:43:22 +0200
committerDavid Thompson <dthompson2@worcester.edu>2022-07-25 20:54:02 -0400
commit6789ffa5366604d361267e96732f25f391943130 (patch)
treee4cee4c1aaa276ed466c64133739d590c0fec02a /sdl2/bindings.scm
parent697a403617b97b4ce333132dae89cb009f6b6e3b (diff)
mouse: Add cursor manipulation bindings.
* sdl2/bindings.scm (SDL_SYSTEM_CURSOR_ARROW, SDL_SYSTEM_CURSOR_IBEAM) (SDL_SYSTEM_CURSOR_WAIT, SDL_SYSTEM_CURSOR_CROSSHAIR) (SDL_SYSTEM_CURSOR_WAITARROW, SDL_SYSTEM_CURSOR_SIZENWSE) (SDL_SYSTEM_CURSOR_SIZENESW, SDL_SYSTEM_CURSOR_SIZEWE) (SDL_SYSTEM_CURSOR_SIZENS, SDL_SYSTEM_CURSOR_SIZEALL) (SDL_SYSTEM_CURSOR_NO, SDL_SYSTEM_CURSOR_HAND, SDL_NUM_SYSTEM_CURSORS): New variables. (sdl-create-system-cursor, sdl-create-color-cursor, sdl-free-cursor) (sdl-set-cursor, sdl-get-cursor, sdl-show-cursor): New procedures. * sdl2/input/mouse.scm (make-system-cursor, make-surface-cursor) (set-cursor!, get-cursor, delete-cursor!): New procedures. * doc/api.texi (Mouse): Document the added features
Diffstat (limited to 'sdl2/bindings.scm')
-rw-r--r--sdl2/bindings.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/sdl2/bindings.scm b/sdl2/bindings.scm
index 897a0dc..954aa8b 100644
--- a/sdl2/bindings.scm
+++ b/sdl2/bindings.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015, 2016, 2021 David Thompson <dthompson2@worcester.edu>
;;; Copyright © 2018 Eero Leno <eero@leno.fi>
;;; Copyright © 2019 Pierre-Antoine Rouby <contact@parouby.fr>
+;;; Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of guile-sdl2.
;;;
@@ -1028,6 +1029,38 @@ RETURN-TYPE and accept arguments of ARG-TYPES."
(define-foreign sdl-warp-mouse-global
int "SDL_WarpMouseGlobal" (list int int))
+(define-public SDL_SYSTEM_CURSOR_ARROW 0)
+(define-public SDL_SYSTEM_CURSOR_IBEAM 1)
+(define-public SDL_SYSTEM_CURSOR_WAIT 2)
+(define-public SDL_SYSTEM_CURSOR_CROSSHAIR 3)
+(define-public SDL_SYSTEM_CURSOR_WAITARROW 4)
+(define-public SDL_SYSTEM_CURSOR_SIZENWSE 5)
+(define-public SDL_SYSTEM_CURSOR_SIZENESW 6)
+(define-public SDL_SYSTEM_CURSOR_SIZEWE 7)
+(define-public SDL_SYSTEM_CURSOR_SIZENS 8)
+(define-public SDL_SYSTEM_CURSOR_SIZEALL 9)
+(define-public SDL_SYSTEM_CURSOR_NO 10)
+(define-public SDL_SYSTEM_CURSOR_HAND 11)
+(define-public SDL_NUM_SYSTEM_CURSORS 12)
+
+(define-foreign sdl-create-system-cursor
+ '* "SDL_CreateSystemCursor" (list int))
+
+(define-foreign sdl-create-color-cursor
+ '* "SDL_CreateColorCursor" (list '* int int))
+
+(define-foreign sdl-free-cursor
+ void "SDL_FreeCursor" (list '*))
+
+(define-foreign sdl-set-cursor
+ void "SDL_SetCursor" (list '*))
+
+(define-foreign sdl-get-cursor
+ '* "SDL_GetCursor" '())
+
+(define-foreign sdl-show-cursor
+ int "SDL_ShowCursor" (list int))
+
;;;
;;; Timer