diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-30 07:35:16 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-30 07:35:16 -0500 |
commit | e0fc8f0f7a8b4756226cfb5e1c7581e411420228 (patch) | |
tree | 57213d8d2997e34d1ba674360b870d4223cd4908 /examples/02-moving-bitmp.lisp | |
parent | 56b743bbfe56823bfe482a4f4e579512041918d2 (diff) |
[refactor] factored out affine from unit; made container a unit;
Diffstat (limited to 'examples/02-moving-bitmp.lisp')
-rw-r--r-- | examples/02-moving-bitmp.lisp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index 3c9ee89..bb6ae8f 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -15,20 +15,20 @@ "Move the target around, grow and shrink it. Print out its position no matter what happens." (case scancode - (:scancode-left (decf (ww::unit-x target) )) - (:scancode-right (incf (ww::unit-x target) )) - (:scancode-down (decf (ww::unit-y target) )) - (:scancode-up (incf (ww::unit-y target) )) + (:scancode-left (decf (ww::x target) )) + (:scancode-right (incf (ww::x target) )) + (:scancode-down (decf (ww::y target) )) + (:scancode-up (incf (ww::y target) )) (:scancode-w (incf (ww::unit-width target) 20)) - (:scancode-r (incf (ww::unit-rotation target) (/ pi 3))) - (:scancode-l (decf (ww::unit-rotation target) (/ pi 3))) + (:scancode-r (incf (ww::rotation target) (/ pi 3))) + (:scancode-l (decf (ww::rotation target) (/ pi 3))) (:scancode-equals (when (or (member :lshift modifiers) (member :rshift modifiers)) (ww::scale-by target 1.10))) (:scancode-minus (ww::scale-by target 0.9))) (format t "ghoul pos: ~a,~a~%" - (ww::unit-x target) (ww::unit-y target)))) + (ww::x target) (ww::y target)))) (ww::defhandler animate-move-thing (ww::on-keydown () @@ -37,8 +37,8 @@ (when (member scancode '(:scancode-left :scancode-right :scancode-down :scancode-up)) (unless (gethash target *shared-anim-table*) (setf (gethash target *shared-anim-table*) t) - (let* ((tx (ww::unit-x target)) - (ty (ww::unit-y target)) + (let* ((tx (ww::x target)) + (ty (ww::y target)) (destx tx) (desty ty) (dx 0) @@ -66,7 +66,7 @@ (ww::defhandler flip-on-click (ww::on-mousedown () - (incf (ww::unit-rotation target) (ww::radians 180) ))) + (incf (ww::rotation target) (ww::radians 180) ))) (ww::defhandler twirl-on-click (ww::on-mousedown () @@ -78,9 +78,9 @@ (ww::on-perframe () (if (< rot (* 8 pi)) (setf rot (+ 0.3 rot) - (ww::unit-rotation target) rot) + (ww::rotation target) rot) (progn - (setf (ww::unit-rotation target) 0.0) + (setf (ww::rotation target) 0.0) (ww::remove-handler target 'ww::perframe) (remhash target *shared-anim-table*))))))))) @@ -117,8 +117,8 @@ (ww::add-handler bm #'mouse-over) ;;second - (setf (ww::unit-x bm2) 90 - (ww::unit-y bm2) 90) + (setf (ww::x bm2) 90 + (ww::y bm2) 90) (ww::add-handler bm2 #'move-thing) (ww::add-handler bm2 #'twirl-on-click ) (ww::add-handler bm2 #'look-at-me) |