X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fexamples%2Fmaking-systems.scm;h=c049a904bb2e1b3d8ea5fd9aaed4d16e1c54353a;hb=7daac782bf89c735e87131f8dc9c04a396415d5a;hp=b3f381decc2fe998b48df3f767909159ba4e3506;hpb=2b3814bf3f335a56c17b733caf90c17dbe229e91;p=gacela.git diff --git a/src/examples/making-systems.scm b/src/examples/making-systems.scm index b3f381d..c049a90 100644 --- a/src/examples/making-systems.scm +++ b/src/examples/making-systems.scm @@ -22,14 +22,25 @@ (define-component a x y) +(define-system s1 () + (list (new-entity (make-a 1 2)) + (new-entity (make-a 10 20)))) + +(define-system s2 ((with-a (a))) + (for-each + (lambda (e) + (format #t "Key: ~a Component: ~a~%" (get-key e) (get-component 'a e))) + with-a) + '()) + (define (making-systems) (let ((entities '()) (components '())) - (receive (e c) (((make-system '() (lambda (e) (list (new-entity (make-a 1 2)) (new-entity (make-a 10 20))))) entities components)) + (receive (e c) ((s1 entities components)) (set! entities e) (set! components c)) (format #t "Two new entities with a:~%~a~%~a~%~%" entities components) - (((make-system '(a) (lambda (e) (display e) (newline) '())) entities components)))) + ((s2 entities components)))) (export making-systems)