(defpackage #:ww.examples/3 (:use :cl)) (in-package #:ww.examples/3) (defclass font-display (ww::application) ()) (define-symbol-macro +speed+ 2) (ww::defhandler move-on-keydown (ww::on-keydown () (case scancode (:scancode-up (incf (ww::unit-y target) +speed+)) (:scancode-down (decf (ww::unit-y target) +speed+)) (:scancode-left (decf (ww::unit-x target) +speed+)) (:scancode-right (incf (ww::unit-x target) +speed+))))) (ww::defhandler marquee (ww::on-perframe () (when (< 800 (ww::unit-x target)) (setf (ww::unit-x target) -800)) (incf (ww::unit-x target) +speed+))) (defmethod ww::boot ((app font-display)) (let ((hello (make-instance 'ww::text :content "Hell! Oh World..." :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2))))) (setf (ww::unit-width hello) (* 5 (ww::unit-width hello)) (ww::unit-height hello) (* 5 (ww::unit-height hello)) (ww::unit-x hello) 100 (ww::unit-y hello) 100) (ww::add-handler hello #'marquee) (ww::refocus-on hello) (ww::add-unit app hello))) (defun start () (ww::start (make-instance 'font-display :fps 60 :refocus-on-mousedown-p nil :title "Wheelwork Example: Font display" :asset-root "~/projects/wheelwork/examples/")))