summaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-11-10 21:29:40 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-11-10 21:29:40 -0500
commit3b814d7eb0b60c691803aa8681bcbd222acac36d (patch)
tree3fdb2ebc3348c9d7cd244ff04a08d4d2f94075d0 /sdl2
parent55c854fc3016b4a3e9328c7c97495d5f3d770e28 (diff)
input: mouse: Add mouse-button-released?
* sdl2/input/mouse.scm (mouse-button-released?): New procedure.
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/input/mouse.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/sdl2/input/mouse.scm b/sdl2/input/mouse.scm
index 55c7833..c172909 100644
--- a/sdl2/input/mouse.scm
+++ b/sdl2/input/mouse.scm
@@ -31,7 +31,8 @@
#:use-module (system foreign)
#:export (mouse-x
mouse-y
- mouse-button-pressed?))
+ mouse-button-pressed?
+ mouse-button-released?))
(define (make-int)
(make-bytevector (sizeof int)))
@@ -65,3 +66,7 @@
('x2 ffi:SDL_BUTTON_X2MASK)))
(buttons (ffi:sdl-get-mouse-state %null-pointer %null-pointer)))
(> (logand mask buttons) 0)))
+
+(define (mouse-button-released? button)
+ "Return #t if BUTTON is not currently being pressed."
+ (not (mouse-button-pressed? button)))