From 3c1df8b7807f772887dc3d85725059c4dbe75cca Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Tue, 19 Jul 2022 06:45:16 -0500 Subject: [rename] bitmap/image --- examples/01-click-and-drag-bitmap.lisp | 51 ---------------------------------- examples/01-click-and-drag-image.lisp | 51 ++++++++++++++++++++++++++++++++++ examples/02-moving-bitmp.lisp | 12 ++++---- examples/07-renderarea.lisp | 2 +- examples/08-pong.lisp | 4 +-- examples/09-ghoulspree.lisp | 2 +- examples/README.txt | 4 +-- 7 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 examples/01-click-and-drag-bitmap.lisp create mode 100644 examples/01-click-and-drag-image.lisp (limited to 'examples') diff --git a/examples/01-click-and-drag-bitmap.lisp b/examples/01-click-and-drag-bitmap.lisp deleted file mode 100644 index 4bcdba8..0000000 --- a/examples/01-click-and-drag-bitmap.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-image.lisp b/examples/01-click-and-drag-image.lisp new file mode 100644 index 0000000..d13bce3 --- /dev/null +++ b/examples/01-click-and-drag-image.lisp @@ -0,0 +1,51 @@ +;;; 01-image-display.lisp + +(defpackage #:ww.examples/1 + (:use #:cl) + (:export #:start)) + +(in-package :ww.examples/1) + +(defclass image-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 image-display)) + (let ((bm + (make-instance 'ww::image + :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 + 'image-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/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index b07f1aa..d0a5598 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -1,4 +1,4 @@ -;;; 01-bitmap-display.lisp +;;; 01-image-display.lisp (defpackage #:ww.examples/2 (:use #:cl) @@ -6,7 +6,7 @@ (in-package :ww.examples/2) -(defclass bitmap-display (ww::application ) ()) +(defclass image-display (ww::application ) ()) (defvar *shared-anim-table* (make-hash-table :synchronized t)) @@ -100,12 +100,12 @@ (ww::on-mousewheel () (print (list :mousewheel horiz vert dir)))) -(defmethod ww::boot ((app bitmap-display)) +(defmethod ww::boot ((app image-display)) (let ((bm - (make-instance 'ww::bitmap + (make-instance 'ww::image :texture (ww::get-asset "Fezghoul.png"))) (bm2 - (make-instance 'ww::bitmap + (make-instance 'ww::image :texture (ww::get-asset "GelatinousCube.png")))) (ww::add-handler app #'wheelie) @@ -130,7 +130,7 @@ (defun start () - (ww::start (make-instance 'bitmap-display + (ww::start (make-instance 'image-display :scale 2.0 :fps 60 :width 800 diff --git a/examples/07-renderarea.lisp b/examples/07-renderarea.lisp index 78d116b..95a6e9d 100644 --- a/examples/07-renderarea.lisp +++ b/examples/07-renderarea.lisp @@ -32,7 +32,7 @@ (defmethod ww::boot ((app scrollarea-example)) (let ((cube (make-instance - 'ww::bitmap + 'ww::image :texture (ww::get-asset "GelatinousCube.png"))) (cube-container (make-instance diff --git a/examples/08-pong.lisp b/examples/08-pong.lisp index 6fc9faa..f40e66d 100644 --- a/examples/08-pong.lisp +++ b/examples/08-pong.lisp @@ -15,8 +15,8 @@ (defclass/std mobile () ((dx dy dr :std 0))) -(defclass/std paddle (ww::bitmap mobile) ()) -(defclass/std ball (ww::bitmap mobile) ()) +(defclass/std paddle (ww::image mobile) ()) +(defclass/std ball (ww::image mobile) ()) ;;; UTILITY FUNCTIONS diff --git a/examples/09-ghoulspree.lisp b/examples/09-ghoulspree.lisp index 463eb89..cf18e31 100644 --- a/examples/09-ghoulspree.lisp +++ b/examples/09-ghoulspree.lisp @@ -14,7 +14,7 @@ (collision-on-p :std t) (gravity-on-p :std nil))) -(defclass/std ghoul (ww:bitmap) +(defclass/std ghoul (ww:image) ((dx dy dr :std))) ;;; UTILITY FUNCTIONS diff --git a/examples/README.txt b/examples/README.txt index 30d8891..ac2d40f 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,13 +1,13 @@ EXAMPLES +---------------------------------- -| 01-clck-and-drag-bitmap.lisp +| 01-clck-and-drag-image.lisp This is the "sanity check" example. It ensures that basic things can happen like "loading textures from disk" and "displaying textures". It also shows off mousevent bubbling to some extent by letting you click -and drag the bitmap. +and drag the image. +---------------------------------- | 02-moving-bitmp.lisp -- cgit v1.2.3