OSDN Git Service

view.lisp: created intermediate viewpoint texture
[rulp/rulp.git] / graphics / render.lisp
index 0447bf7..34139db 100644 (file)
           :do (when (sdl2:has-intersect mouse-point
                                         (screen-destination entity plane))
                 entity))))
+
+;; NOTE: this doesn't directly uses +plane+ so it can be easily generalized
+(defmacro render-plane-and-contents (renderer plane)
+  "given a PLANE it renders globally the plane images and entities. With
+globally it means that this plane is rendered full on whatever texture is used.
+to render locally use sdl2:set-render-target before calling this macro."
+  `(when ,plane
+     (sdl2:render-copy ,renderer (texture ,plane)
+                       :source-rect (screen-source ,plane)
+                       :dest-rect (screen-destination ,plane t))
+     (loop :for entity :in (entities-list ,plane)
+           :do (when (displayp entity)
+                 (sdl2:render-copy ,renderer (texture entity)
+                                   :source-rect (screen-source entity)
+                                   :dest-rect (screen-destination entity ,plane))))))
+
+;; NOTE: test if it is necessary to create render-plane-without-contents