diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/02-moving-bitmp.lisp | 28 | ||||
-rw-r--r-- | examples/RootBear.png | bin | 0 -> 4089 bytes |
2 files changed, 23 insertions, 5 deletions
diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index 425457b..4706d1b 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -21,21 +21,39 @@ (incf (ww::unit-width unit) 20.0))) (:scancode-minus (decf (ww::unit-height unit) 20.0) - (decf (ww::unit-width unit) 20.0))))) + (decf (ww::unit-width unit) 20.0))) + (format t "ghoul pos: ~a,~a~%" + (ww::unit-x unit) (ww::unit-y unit)))) + +(ww::defhandler thing-clicked + (ww::on-mousedown (unit x y clicks button) + (format t "~a was clicked at ~a,~a!~%" unit x y))) (defmethod ww::boot ((app bitmap-display)) (let ((bm (make-instance 'ww::bitmap - :texture (ww::get-asset "Fezghoul.png")))) + :texture (ww::get-asset "Fezghoul.png"))) + (bm2 + (make-instance 'ww::bitmap + :texture (ww::get-asset "RootBear.png")))) + ;; first (ww::refocus-on bm) (ww::set-handler bm #'move-thing) - (ww::add-unit app bm))) + (ww::set-handler bm #'thing-clicked ) + (ww::add-unit app bm) + ;;second + (setf (ww::unit-x bm2) 90 + (ww::unit-y bm2) 90) + (ww::set-handler bm2 #'move-thing) + (ww::set-handler bm2 #'thing-clicked) + (ww::add-unit app bm2))) (defun start () (ww::start (make-instance 'bitmap-display - :scale 3.0 + :scale 2.0 :asset-root #P"~/projects/wheelwork/examples/"))) -(start) + + diff --git a/examples/RootBear.png b/examples/RootBear.png Binary files differnew file mode 100644 index 0000000..fd51298 --- /dev/null +++ b/examples/RootBear.png |