File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
; ;; Mouse
12
12
13
+ (defparameter *buttons* ' (:left nil :middle nil :right nil ))
14
+
15
+ (defmethod on-click ((instance sketch) x y))
16
+ (defmethod on-middle-click ((instance sketch) x y))
17
+ (defmethod on-right-click ((instance sketch) x y))
18
+
19
+ (defmethod kit.sdl2 :mousebutton-event ((instance sketch) state timestamp button x y)
20
+ (let ((button (elt (list nil :left :middle :right ) button))
21
+ (method (elt (list nil #' on-click #' on-middle-click #' on-right-click) button)))
22
+ (when (equal state :mousebuttondown )
23
+ (setf (getf *buttons* button) t ))
24
+ (when (and (equal state :mousebuttonup ) (getf *buttons* button))
25
+ (setf (getf *buttons* button) nil )
26
+ (funcall method instance x y))))
27
+
13
28
(defmethod kit.sdl2 :mousemotion-event :after ((instance sketch)
14
29
timestamp button-mask x y xrel yrel)
15
30
(out :mouse (cons x y)
Original file line number Diff line number Diff line change 171
171
:canvas-width
172
172
:canvas-height
173
173
:draw-canvas
174
+
175
+ ; ; Controllers
176
+ :on-click
177
+ :on-middle-click
178
+ :on-right-click
174
179
))
You can’t perform that action at this time.
0 commit comments