Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add show-cursor-p function to sdl2 API wrapper #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/mouse.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
`(sdl-warp-mouse-in-window ,win ,x ,y))

(defun hide-cursor ()
"Set the cursor to invisible in all SDL2 windows."
(sdl-true-p (check-rc (sdl-show-cursor sdl2-ffi:+sdl-disable+))))

(defun show-cursor ()
"Set the cursor to visible in all SDL2 windows."
(sdl-true-p (check-rc (sdl-show-cursor sdl2-ffi:+sdl-enable+))))

(defun show-cursor-p ()
"Returns whether the cursor is currently visible."
(ecase (check-rc (sdl-show-cursor sdl2-ffi:+sdl-query+))
(0 nil)
(1 t)))

(defun set-relative-mouse-mode (enabled)
(let ((enabled (ecase enabled ((1 t) 1) ((0 nil) 0))))
(check-rc (sdl-set-relative-mouse-mode enabled))))
Expand Down
1 change: 1 addition & 0 deletions src/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
#:warp-mouse-in-window
#:hide-cursor
#:show-cursor
#:show-cursor-p
#:set-relative-mouse-mode
#:relative-mouse-mode-p
#:toggle-relative-mouse-mode
Expand Down