aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-22 09:25:57 -0500
committerColin Okay <colin@cicadas.surf>2022-06-22 09:25:57 -0500
commiteb34cd2d8798ef144425c8b4f03b7e6d9efd7f08 (patch)
tree637ae05c080b57818513df6b95938df788ddd5ae /examples
parent7a9f89e46e21f2c18d6e61eee16c6d37bdd27800 (diff)
[fix] bad slots in cache invalidation code.
Diffstat (limited to 'examples')
-rw-r--r--examples/02-moving-bitmp.lisp33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp
new file mode 100644
index 0000000..e7faeac
--- /dev/null
+++ b/examples/02-moving-bitmp.lisp
@@ -0,0 +1,33 @@
+;;; 01-bitmap-display.lisp
+
+(defpackage #:ww.examples/2
+ (:use #:cl)
+ (:export #:start))
+
+(in-package :ww.examples/2)
+
+(defclass bitmap-display (ww::application ) ())
+
+(ww::defhandler move-thing
+ (ww::on-keydown (target code mods)
+ (case code
+ (: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
+ (print mods)))))
+
+(defmethod ww::boot ((app bitmap-display))
+ (let ((bm
+ (make-instance 'ww::bitmap
+ :texture (ww::get-asset "Fezghoul.png"))))
+ (ww::refocus-on bm)
+ (ww::set-handler bm *move-thing*)
+ (ww::add-unit app bm)))
+
+
+(defun start ()
+ (ww::start (make-instance 'bitmap-display
+ :scale 3.0
+ :asset-root #P"~/projects/wheelwork/examples/")))