From e5104cf39570605859c3648ed83c37fe647b0e3f Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 27 Jun 2022 15:23:35 -0500 Subject: [example] 1 2 and 3 find the right asset root automatically --- examples/01-bitmap-display.lisp | 8 ++++++-- examples/02-moving-bitmp.lisp | 4 +++- examples/03-font-render.lisp | 11 ++++++----- wheelwork.lisp | 2 ++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/examples/01-bitmap-display.lisp b/examples/01-bitmap-display.lisp index 788ae6d..c9e0275 100644 --- a/examples/01-bitmap-display.lisp +++ b/examples/01-bitmap-display.lisp @@ -19,5 +19,9 @@ (defun start () - (ww::start (make-instance 'bitmap-display - :asset-root #P"~/projects/wheelwork/examples/"))) + (ww::start + (make-instance + 'bitmap-display + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))))) diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index 53a4f35..e656367 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -114,7 +114,9 @@ (ww::start (make-instance 'bitmap-display :scale 2.0 :fps 30 - :asset-root #P"~/projects/wheelwork/examples/"))) + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))))) diff --git a/examples/03-font-render.lisp b/examples/03-font-render.lisp index 3a3d659..fb43b08 100644 --- a/examples/03-font-render.lisp +++ b/examples/03-font-render.lisp @@ -1,6 +1,7 @@ (defpackage #:ww.examples/3 - (:use :cl)) + (:use #:cl) + (:export #:start)) (in-package #:ww.examples/3) @@ -25,14 +26,12 @@ (when (< 900 (ww::unit-x target)) (setf (ww::unit-x target) -800)) - ;(incf (ww::unit-x target) 5) - )) + (incf (ww::unit-x target) 5))) (defmethod ww::boot ((app font-display)) (let ((hello (make-instance 'ww::text - ;:content "Yom" :content "Hell! Oh World..." :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2))))) @@ -61,7 +60,9 @@ :fps 60 :refocus-on-mousedown-p nil :title "Wheelwork Example: Font display" - :asset-root "~/projects/wheelwork/examples/") + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))) :x 2380)) diff --git a/wheelwork.lisp b/wheelwork.lisp index 5807f30..555366b 100644 --- a/wheelwork.lisp +++ b/wheelwork.lisp @@ -422,6 +422,8 @@ TARGET is FOCUSABLEP" "EVENT-TYPE must be one of the slot value names for WHEELWORK::LISTENER." (?> (unit) listener #$(slot-value $listener event-type))) + + (defun eventloop-keydown (app sdl-keysym) (let ((target (get-focus app))) (when-let (handler (get-handler-for target 'keydown)) -- cgit v1.2.3