;;; Gacela, a GNU Guile extension for fast games development
-;;; Copyright (C) 2013 by Javier Sancho Fernandez <jsf at jsancho dot org>
+;;; Copyright (C) 2016 by Javier Sancho Fernandez <jsf at jsancho dot org>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(use-modules (gacela system)
+(use-modules (gacela entity)
+ (ice-9 receive)
(srfi srfi-64))
(test-begin "entities")
-(define-component a x y)
-(define-component b)
-
-(define entities (make-entity-set))
+(define entity-set (make-entity-set))
+(define key #f)
; Creating entities
-(set! entities ((new-entity (make-a 1 2) (make-b)) entities))
-(set! entities ((new-entity (make-a 10 20)) entities))
-((new-entity (make-a 10 20)) entities)
-(test-eqv 2 (length (entity-list entities)))
+
+(receive (e k) (add-entities entity-set '((a . (1 2)) (b . #f)))
+ (set! entity-set e)
+ (set! key (car k)))
+(set! entity-set (add-entities entity-set '((a . (10 20)))))
+(add-entities entity-set '((a . (10 20))))
+(test-eqv 2 (entities-count entity-set))
+
+;; (define-component a x y)
+;; (define-component b)
+
+;; (define entities (make-entity-set))
+;; (define key #f)
+
+;; ; Modifying entities
+;; (define component (assoc-ref (get-entity entities key) 'a))
+;; (test-eqv 1 (a-x component))
+;; (test-eqv 2 (a-y component))
(test-end "entities")