From 8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 10 Dec 2024 07:11:02 -0800 Subject: Replaced defclass-std with def --- examples/02-image-transforms-and-events.lisp | 17 ++++++------ examples/03-font-render.lisp | 39 +++++++++++++--------------- examples/08-pong.lisp | 25 ++++++++++++------ examples/09-ghoulspree.lisp | 16 ++++++------ examples/10-canvas-sneks.lisp | 27 ++++++++++--------- examples/12-canvas-drawing-language.lisp | 2 +- 6 files changed, 66 insertions(+), 60 deletions(-) (limited to 'examples') diff --git a/examples/02-image-transforms-and-events.lisp b/examples/02-image-transforms-and-events.lisp index 9e4710f..b81f788 100644 --- a/examples/02-image-transforms-and-events.lisp +++ b/examples/02-image-transforms-and-events.lisp @@ -131,14 +131,15 @@ (defun start () - (ww::start (make-instance 'image-transforms-etc - :scale 2.0 - :fps 60 - :width 800 - :height 600 - :asset-root (merge-pathnames - "examples/" - (asdf:system-source-directory :wheelwork))))) + (ww::start + (make-instance 'image-transforms-etc + :scale 2.0 + :fps 60 + :width 800 + :height 600 + :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 de3c487..ba575ca 100644 --- a/examples/03-font-render.lisp +++ b/examples/03-font-render.lisp @@ -44,21 +44,18 @@ (remhash target *spin-table*)))))) (ww::defhandler twirl-on-click - (ww::on-mousedown () - (ww::add-handler target #'spin))) + (ww::on-mousedown () + (ww::add-handler target #'spin))) (defmethod ww::boot ((app font-display)) (let ((hello - (make-instance - 'ww::text - ;:content "Hell! Oh World ..." - :content (format nil "Hell!~%Oh World...") - :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2)))) + (make-instance 'ww::text + :content (format nil "Hell!~%Oh World...") + :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2)))) (instructions - (make-instance - 'ww::text - :content "Click to spin. Press any key to change color." - :font (ww::get-asset "Ticketing.ttf")))) + (make-instance 'ww::text + :content "Click to spin. Press any key to change color." + :font (ww::get-asset "Ticketing.ttf")))) (ww::scale-by hello 3.0) (setf @@ -77,16 +74,16 @@ (defun start () - (ww::start (make-instance - 'font-display - :fps 60 - :refocus-on-mousedown-p nil - :width 800 - :height 600 - :title "Wheelwork Example: Font display" - :asset-root (merge-pathnames - "examples/" - (asdf:system-source-directory :wheelwork))))) + (ww::start + (make-instance 'font-display + :fps 60 + :refocus-on-mousedown-p nil + :width 800 + :height 600 + :title "Wheelwork Example: Font display" + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))))) diff --git a/examples/08-pong.lisp b/examples/08-pong.lisp index 574eacd..ecc529b 100644 --- a/examples/08-pong.lisp +++ b/examples/08-pong.lisp @@ -2,21 +2,30 @@ (defpackage #:ww.examples/8 (:use #:cl) - (:export #:start) - (:import-from #:defclass-std #:defclass/std)) + (:export #:start)) (in-package #:ww.examples/8) ;;; CLASSES -(defclass/std solo-pong (ww::application) - ((paddle ball game-over intro-text))) +(def:class solo-pong (ww::application) + (paddle ball game-over intro-text)) -(defclass/std mobile () - ((dx dy dr :std 0))) +;; (defclass/std solo-pong (ww::application) +;; ((paddle ball game-over intro-text))) -(defclass/std paddle (ww::image mobile) ()) -(defclass/std ball (ww::image mobile) ()) +(def:class mobile () + (dx dy dr :initform 0)) + + +;; (defclass/std mobile () +;; ((dx dy dr :std 0))) + +(def:class paddle (ww:image mobile)) +(def:class ball (ww:image 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 33a5423..04b1043 100644 --- a/examples/09-ghoulspree.lisp +++ b/examples/09-ghoulspree.lisp @@ -2,20 +2,20 @@ (defpackage #:ww.examples/9 (:use #:cl) - (:export #:start) - (:import-from #:defclass-std #:defclass/std)) + (:export #:start)) (in-package #:ww.examples/9) ;;; CLASSES -(defclass/std ghoulspree (ww::application) - ((ghouls-per-click :std 20) - (collision-on-p :std t) - (gravity-on-p :std nil))) +(def:class ghoulspree (ww:application) + (ghouls-per-click :type fixnum :initform 20) + (collision-on-p :type boolean :initform t) + (gravity-on-p :type boolean :initform nil)) + +(def:class ghoul (ww:image) + (dx dy dr :type fixnum :initform 0)) -(defclass/std ghoul (ww:image) - ((dx dy dr :std))) ;;; UTILITY FUNCTIONS diff --git a/examples/10-canvas-sneks.lisp b/examples/10-canvas-sneks.lisp index ef5d1d5..52c71fd 100644 --- a/examples/10-canvas-sneks.lisp +++ b/examples/10-canvas-sneks.lisp @@ -2,25 +2,24 @@ (defpackage #:ww.examples/10 (:use #:cl) - (:export #:start) - (:import-from #:defclass-std #:defclass/std)) + (:export #:start)) (in-package #:ww.examples/10) ;;; CLASSES -(defclass/std sneking (ww:application) - ((sneks snek-pit) - (population :std 10))) - -(defclass/std snek () - ((x y) - (dx dy :std 1) - (brain :std 0.0) - (bod :std (list)) - (len :std 4) - (color :std (list 255 255 255)) - (home :std (list 0 0 100 100)))) +(def:class sneking (ww:application) + (sneks snek-pit :initform nil) + (population :initform 10)) + +(def:class snek () + (x y dx dy :initform 1) + (brain :initform 0.0) + (bod :initform (list)) + (len :initform 4) + (color :initform (list 255 255 255)) + (home :initform (list 0 0 100 100)) + :documentation "A SNEK is a contiguous chain of virtual pixels (i.e. square blocks of color), all the same coloor") (defun snek-is-home-p (snek) (with-slots (x y home) snek diff --git a/examples/12-canvas-drawing-language.lisp b/examples/12-canvas-drawing-language.lisp index a727f7b..7c71dea 100644 --- a/examples/12-canvas-drawing-language.lisp +++ b/examples/12-canvas-drawing-language.lisp @@ -1,4 +1,4 @@ -;;;; examples/13-canvas-drawing-language.lisp +;;;; examples/12-canvas-drawing-language.lisp (defpackage #:ww.examples/12 (:use #:cl) -- cgit v1.2.3