OSDN Git Service

view: entities-list in plane and fixes
[rulp/rulp.git] / graphics / view.lisp
index 400d594..6304763 100644 (file)
                          ;; :image (merge-pathnames map-path (cdr (assoc :image-path entity-info)))
                          :background (merge-pathnames map-path (cdr (assoc :image-path entity-info)))
                          :size (if (assoc :size entity-info) (cdr (assoc :size entity-info)) 1)
-                         :name (assoc :name entity-info)
+                         :name (cdr (assoc :name entity-info))
                          ))))
 
+;; FIXME: this design can be improved with the use of cl-json options
+(defun create-entity (alist map-path)
+  (make-instance 'entity
+                 :background (merge-pathnames map-path (cdr (assoc :image-path alist)))
+                 :size (if (assoc :size alist) (cdr (assoc :size alist)) 1)
+                 :name (assoc :name alist)
+                 ))
+
 (defun create-plane (map-info map-path &key (number 0))
   "convert the map informations into a functioning plane, without number it convert the
 first element"
   (let ((plane-info (nth number (cdr (assoc :planes map-info)))))
     (make-instance 'rulp.layers:plane
                    :background (merge-pathnames map-path (cdr (assoc :image-path plane-info)))
-                   :entities-list (create-entities map-info map-path)
+                   :entities-list (map 'list #'(lambda (x) (create-entity x map-path)) (cdr (assoc :entities plane-info)))
                    :grid (make-instance 'squaregrid
                                         :span (cdr (assoc :grid-dimension plane-info)))
                    )
@@ -107,7 +115,7 @@ DEBUG-INFO can be used to display the content on screen for test and debug purpo
       (setf *plane-grid* (span (rulp.layers:plane-grid *plane*)))
       ;; FIXME: to remove
 
-      (setf *entities-list* (entities-list *plane*))
+      ;; (setf *entities-list* (entities-list *plane*))
       (loop :for i :in *execute-before*
             :do (eval `(,i)))
       ;; FIXME: to remove