aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/03-font-render.lisp4
-rw-r--r--examples/08-pong.lisp25
-rw-r--r--examples/09-ghoulspree.lisp16
-rw-r--r--examples/10-canvas-sneks.lisp27
4 files changed, 40 insertions, 32 deletions
diff --git a/examples/03-font-render.lisp b/examples/03-font-render.lisp
index 66d097d..ba575ca 100644
--- a/examples/03-font-render.lisp
+++ b/examples/03-font-render.lisp
@@ -44,8 +44,8 @@
(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
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