diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/02-moving-bitmp.lisp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index 5d33de8..200a1d1 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -9,28 +9,28 @@ (defclass bitmap-display (ww::application ) ()) (ww::defhandler move-thing - (ww::on-keydown (unit code mods) - (case code - (:scancode-left (decf (ww::unit-x unit) (ww::unit-width unit))) - (:scancode-right (incf (ww::unit-x unit) (ww::unit-width unit))) - (:scancode-down (decf (ww::unit-y unit) (ww::unit-height unit))) - (:scancode-up (incf (ww::unit-y unit) (ww::unit-height unit))) + (ww::on-keydown () + (case scancode + (:scancode-left (decf (ww::unit-x target) (ww::unit-width target))) + (:scancode-right (incf (ww::unit-x target) (ww::unit-width target))) + (:scancode-down (decf (ww::unit-y target) (ww::unit-height target))) + (:scancode-up (incf (ww::unit-y target) (ww::unit-height target))) (:scancode-equals - (when (or (member :lshift mods) (member :rshift mods)) - (incf (ww::unit-height unit) 20.0) - (incf (ww::unit-width unit) 20.0))) + (when (or (member :lshift modifiers) (member :rshift modifiers)) + (incf (ww::unit-height target) 20.0) + (incf (ww::unit-width target) 20.0))) (:scancode-minus - (decf (ww::unit-height unit) 20.0) - (decf (ww::unit-width unit) 20.0))) + (decf (ww::unit-height target) 20.0) + (decf (ww::unit-width target) 20.0))) (format t "ghoul pos: ~a,~a~%" - (ww::unit-x unit) (ww::unit-y unit)))) + (ww::unit-x target) (ww::unit-y target)))) (ww::defhandler thing-clicked - (ww::on-mousedown (unit x y clicks button) - (format t "~a was clicked at ~a,~a!~%" unit x y))) + (ww::on-mousedown () + (format t "~a was clicked at ~a,~a!~%" target x y))) (ww::defhandler mouse-over - (ww::on-mousemotion (target x y xrel yrel state) + (ww::on-mousemotion () (print (list target x y xrel yrel state)))) (defmethod ww::boot ((app bitmap-display)) |