aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-27 10:43:04 -0500
committerColin Okay <colin@cicadas.surf>2022-06-27 10:43:04 -0500
commit9c058339dde198062e96674c515ea946de5902b5 (patch)
tree67a3a925942db29bcfbd540f33aec6bdb6b84b35 /examples
parentbb1baae5c6c9ba1f1bba26696920e272df6bee85 (diff)
[modify] get-focus & refocus-on: allow focus on not focusablep
Diffstat (limited to 'examples')
-rw-r--r--examples/03-font-render.lisp14
1 files changed, 13 insertions, 1 deletions
diff --git a/examples/03-font-render.lisp b/examples/03-font-render.lisp
index 6e1637a..e04d0c8 100644
--- a/examples/03-font-render.lisp
+++ b/examples/03-font-render.lisp
@@ -4,9 +4,16 @@
(in-package #:ww.example/3)
-
(defclass font-display (ww::application) ())
+(ww::defhandler move-on-keydown
+ (ww::on-keydown ()
+ (case scancode
+ (:scancode-up (incf (ww::unit-y target)))
+ (:scancode-down (decf (ww::unit-y target)))
+ (:scancode-left (decf (ww::unit-x target)))
+ (:scancode-right (incf (ww::unit-x target))))))
+
(defmethod ww::boot ((app font-display))
(let ((hello
(make-instance
@@ -24,11 +31,16 @@
(ww::unit-y hello) 100)
+ (ww::set-handler hello #'move-on-keydown)
+
+ (ww::refocus-on hello)
+
(ww::add-unit app hello)))
(defun start ()
(ww::start (make-instance 'font-display
+ :refocus-on-mousedown-p nil
:title "Wheelwork Example: Font display"
:asset-root "~/projects/wheelwork/examples/")))