OSDN Git Service

FIX: entities under flyweight
[rulp/rulp.git] / graphics / render.lisp
index 5b14ece..1b53e3b 100644 (file)
@@ -70,24 +70,17 @@ rectangle directly, but use the arrange-rect")
                                         (screen-destination entity plane))
                 entity))))
 
-(defmacro render-plane-and-entities (renderer)
-  "using *plane* and *entities-list* the macro display on the current rendering texture
-the plane 'as is' and the entities with the grid-layout function"
-  `(when *plane*
-     ;; NOTE: add error for non-screen planes
-     (display *plane*)
-     ;; (sdl2:render-copy ,renderer (texture *plane*)
-     ;;                   :source-rect nil
-     ;;                   :dest-rect (screen-destination *plane* t))
-     (loop :for entity :in *entities-list*
-           :do
-              (when (displayp entity)
-                (multiple-value-bind (coordinates size) (grid-layout (car (coordinate entity))
-                                                                     (cdr (coordinate entity))
-                                                                     :size (size entity))
-                  (sdl2:render-copy ,renderer (texture entity)
-                                    :source-rect nil ; NOTE: not general
-                                    :dest-rect (arrange-rect (car coordinates) (cdr coordinates) size size)))) ; FIXME: create a grid-layout function
-           )
-     )
+;; BUG: when the system loads it doesn't fill the variable
+;; *execute-in-viewpoint* therefore this function is never executed
+(defchain render-plane-and-entities :viewpoint
+;;   "using *plane* and *entities-list* the macro display on the current rendering texture
+;; the plane 'as is' and the entities with the grid-layout function"
+  (when *plane*
+    ;; NOTE: add error for non-screen planes
+    (display *plane* t)
+    (loop :for entity :in (entities-list *plane*)
+          :do
+             (when (displayp entity)
+               (display entity (plane-grid *plane*))
+               )))                                        ; FIXME: create a grid-layout function
   )