aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/10-canvas-sneks.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-12-10 07:11:02 -0800
committercolin <colin@cicadas.surf>2024-12-14 08:35:58 -0800
commit8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (patch)
tree23f5f0a5449a06473aba2ec7914a3c2193823a10 /examples/10-canvas-sneks.lisp
parent2cbb8e4114c860e1774efd40d18661aee8ab2a72 (diff)
Replaced defclass-std with defrefactor-with-def
Diffstat (limited to 'examples/10-canvas-sneks.lisp')
-rw-r--r--examples/10-canvas-sneks.lisp27
1 files changed, 13 insertions, 14 deletions
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