diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-23 10:15:24 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-23 10:15:24 -0500 |
commit | 4c663321eeda689ac77e7794099e10249ebdc8f5 (patch) | |
tree | 8d1fc53ccdcd8486275f6fb5e2a1c82a8a2bbffd /examples/02-moving-bitmp.lisp | |
parent | c03373741557666526202f7dc5150d82073f6f81 (diff) |
[modify] on-* macros to make arguments optional
Diffstat (limited to 'examples/02-moving-bitmp.lisp')
-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)) |