aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-23 08:56:28 -0500
committerColin Okay <colin@cicadas.surf>2022-06-23 08:56:28 -0500
commit76d137475350287f6eddf7083ff0b7507a305e8c (patch)
treefea80ddf20419287d857ccd5495bad0717ca2236 /examples
parentd9fba3559d77e96f145ab1fd968bce868074044e (diff)
[add] eventhandling for mousedown and keyup
Diffstat (limited to 'examples')
-rw-r--r--examples/02-moving-bitmp.lisp28
-rw-r--r--examples/RootBear.pngbin0 -> 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
new file mode 100644
index 0000000..fd51298
--- /dev/null
+++ b/examples/RootBear.png
Binary files differ