I'm trying to manage some events in lisp with lispbuilder-sdl.
Thus far I got this.
;; Load package :
(ql:quickload "lispbuilder-sdl")
;; main definition:
(defun main (argv)
(defparameter *ticks* 0)
(sdl:with-init ()
(sdl:window 100 100 :title-caption "test")
(sdl:with-events ()
(setf (sdl:frame-rate) 60)
(:quit-event () (progn (sdl:quit-image) (exit) t))
(:mouse-button-down-event
(:button button :x x :y y)
(format t "~&LSHIFT: ~a RSHIFT: ~a BUTTON: ~a X: ~d Y: ~d"
(sdl:get-key-state :sdl-key-lshift)
(sdl:get-key-state :sdl-key-rshift)
button x y))
(:key-down-event
(:key key)
(format t "~& KEY: ~a" key))
(:idle ()))))
;; Entrypoint :
(sb-int:with-float-traps-masked (:invalid :inexact :overflow) (main *posix-argv*))
If I launch this, a window appear, I can click and roll, I got an output to describe the state of the keys and buttons pressed. Same if I press a key down. Fine.
But something weird occurs when I keep a shift key down.
If I do so, I still have the output when clicking. But not when rolling (mouse wheel events).
So I guess mouse-wheel events simply arent triggered when a shift (right or left) is down. But only shift keys, and I don't even know why.
So I can't for instance handle shift+mouse-wheel events.
Any idea?
NB : The version of SBCL I use on OSX is 1.2.11 but it works with both 1.3.2 and 1.2.11 on Ubuntu.