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.
(put 'sdl:with-events 'common-lisp-indent-function '(4 &rest (&whole 2 4 &rest 2)))
to tell Emacs how to do it). All thoseprogn
s seem to be unnecessary as well, and you probably should just useformat
instead of multipleprint
s. – Approximalsb-int:with-float-traps-masked
) – Approximal--with-dynamic-ffi
as an argument to configure. – Approximal--with-segv-prefix
it doesn't work. I've also tried to install it like the error message suggests. If I try to skip and to run make, I got a C compilation error :avcall.h : file not found
– Necessity