From dc83fef581b1da9ac6944a4c610fed9789d245b6 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 18 Jul 2022 10:25:44 -0500 Subject: [rename] example 1 --- examples/01-bitmap-display.lisp | 51 ---------------------------------- examples/01-click-and-drag-bitmap.lisp | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 examples/01-bitmap-display.lisp create mode 100644 examples/01-click-and-drag-bitmap.lisp (limited to 'examples') diff --git a/examples/01-bitmap-display.lisp b/examples/01-bitmap-display.lisp deleted file mode 100644 index 4bcdba8..0000000 --- a/examples/01-bitmap-display.lisp +++ /dev/null @@ -1,51 +0,0 @@ -;;; 01-bitmap-display.lisp - -(defpackage #:ww.examples/1 - (:use #:cl) - (:export #:start)) - -(in-package :ww.examples/1) - -(defclass bitmap-display (ww::application ) ()) - -(ww::defhandler dragging-unit - (ww::on-mousemotion (app x y) - (let ((unit - (first (ww:container-units app)))) - (setf (ww:x unit) x - (ww:y unit) y)))) - -(ww:defhandler start-drag - (ww:on-mousedown (target) - (ww::add-handler - (ww::unit-container target) - #'dragging-unit))) - -(ww:defhandler stop-drag - (ww::on-mouseup (app) - (ww::remove-handler app #'dragging-unit))) - - -(defmethod ww::boot ((app bitmap-display)) - (let ((bm - (make-instance 'ww::bitmap - :texture (ww::get-asset "Fezghoul.png")))) - (describe (ww::model-matrix bm)) - (describe bm) - (describe app) - (ww::add-unit app bm) - (ww::add-handler bm #'start-drag) - (ww::add-handler app #'stop-drag) - (format t "CLICK AND DRAG THE GHOUL~%") - )) - - -(defun start () - (ww::start - (make-instance - 'bitmap-display - :mouse-button-events-bubble-p t - :mouse-motion-events-bubble-p t - :asset-root (merge-pathnames - "examples/" - (asdf:system-source-directory :wheelwork))))) diff --git a/examples/01-click-and-drag-bitmap.lisp b/examples/01-click-and-drag-bitmap.lisp new file mode 100644 index 0000000..4bcdba8 --- /dev/null +++ b/examples/01-click-and-drag-bitmap.lisp @@ -0,0 +1,51 @@ +;;; 01-bitmap-display.lisp + +(defpackage #:ww.examples/1 + (:use #:cl) + (:export #:start)) + +(in-package :ww.examples/1) + +(defclass bitmap-display (ww::application ) ()) + +(ww::defhandler dragging-unit + (ww::on-mousemotion (app x y) + (let ((unit + (first (ww:container-units app)))) + (setf (ww:x unit) x + (ww:y unit) y)))) + +(ww:defhandler start-drag + (ww:on-mousedown (target) + (ww::add-handler + (ww::unit-container target) + #'dragging-unit))) + +(ww:defhandler stop-drag + (ww::on-mouseup (app) + (ww::remove-handler app #'dragging-unit))) + + +(defmethod ww::boot ((app bitmap-display)) + (let ((bm + (make-instance 'ww::bitmap + :texture (ww::get-asset "Fezghoul.png")))) + (describe (ww::model-matrix bm)) + (describe bm) + (describe app) + (ww::add-unit app bm) + (ww::add-handler bm #'start-drag) + (ww::add-handler app #'stop-drag) + (format t "CLICK AND DRAG THE GHOUL~%") + )) + + +(defun start () + (ww::start + (make-instance + 'bitmap-display + :mouse-button-events-bubble-p t + :mouse-motion-events-bubble-p t + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))))) -- cgit v1.2.3