]> git.jsancho.org Git - gacela.git/blobdiff - src/test.scm
It's not obligatory to write type components at declarations; if
[gacela.git] / src / test.scm
index 8b7723fa8f6c7234955422f9386ed671ccf86b9f..021afefc8744e4defc8af120bb12d096af8a3679 100644 (file)
   (let ((entities '())
        (components '())
        (key #f))
-    (receive (e c k) (new-entity `((a . ,(make-a 1 2)) (b . ,(make-b))) entities components)
+    (receive (e c k) (new-entity (list (make-a 1 2) (make-b)) entities components)
             (set! entities e)
             (set! components c)
             (set! key k)
             (display k) (newline))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "New entity with a and b:~%~a~%~a~%~%" entities components)
 
-    (receive (e c k) (new-entity `((a . ,(make-a 10 20))) entities components)
+    (receive (e c k) (new-entity (list (make-a 10 20)) entities components)
             (set! entities e)
             (set! components c)
             (display k) (newline))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "New entity with a:~%~a~%~a~%~%" entities components)
 
-    (receive (e c) (set-entity-components key `((b . #f) (a . ,(make-a 50 50))) entities components)
+    (receive (e c) (set-entity-components key `((b . #f) ,(make-a 50 50)) entities components)
             (set! entities e)
             (set! components c))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "First entity removes b and changes a:~%~a~%~a~%~%" entities components)
 
     (receive (e c) (remove-entity key entities components)
             (set! entities e)
             (set! components c))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "Removes first entity:~%~a~%~a~%~%" entities components)
 
-    (receive (e c k) (new-entity `((a . ,(make-a 1 2)) (b . ,(make-b))) entities components)
+    (receive (e c k) (new-entity (list (make-a 1 2) (make-b)) entities components)
             (set! entities e)
             (set! components c)
             (set! key k)
             (display k) (newline))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "New entity with a and b:~%~a~%~a~%~%" entities components)
 
-    (receive (e c) (set-entities `((,key . ((b . #f) (a . ,(make-a 50 50)))) (#f . ((a . ,(make-a 1000 1000))))) entities components)
+    (receive (e c) (set-entities `((,key . ((b . #f) ,(make-a 50 50))) (#f . (,(make-a 1000 1000)))) entities components)
             (set! entities e)
             (set! components c))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "Last entity removes b and changes a, and new entity with a:~%~a~%~a~%~%" entities components)
 
     (receive (e c) (set-entities `((,key . #f)) entities components)
             (set! entities e)
             (set! components c))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "Remove last entity:~%~a~%~a~%~%" entities components)
 ))
 
 (export test1)
 (define (test2)
   (let ((entities '())
        (components '()))
-    (receive (e c) (((make-system '() (lambda (e) `((#f . ((a . ,(make-a 1 2)))) (#f . ((a . ,(make-a 10 20))))))) entities components))
+    (receive (e c) (((make-system '() (lambda (e) `((#f . (,(make-a 1 2))) (#f . (,(make-a 10 20)))))) entities components))
             (set! entities e)
             (set! components c))
-    (format #t "~a~%~a~%~%" entities components)
+    (format #t "Two new entities with a:~%~a~%~a~%~%" entities components)
 
     (((make-system '(a) (lambda (e) (display e) (newline) '())) entities components))
 ))