aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/10-canvas-sneks.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-12-14 08:36:23 -0800
committercolin <colin@cicadas.surf>2024-12-14 08:36:23 -0800
commit3a2217263d581be9a7f629b10d75aa8e3d581890 (patch)
tree23f5f0a5449a06473aba2ec7914a3c2193823a10 /examples/10-canvas-sneks.lisp
parent03cdbb6a15e130a012377ab8d54074b6864e3480 (diff)
parent8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (diff)
Merge branch 'refactor-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