From 6789ffa5366604d361267e96732f25f391943130 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 22 Jul 2022 14:43:22 +0200 Subject: 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 --- sdl2/bindings.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'sdl2/bindings.scm') 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 ;;; Copyright © 2018 Eero Leno ;;; Copyright © 2019 Pierre-Antoine Rouby +;;; Copyright © 2022 Ekaitz Zarraga ;;; ;;; 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 -- cgit v1.2.3