aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/application.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.lisp')
-rw-r--r--src/application.lisp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/application.lisp b/src/application.lisp
index 3b531c9..62849c9 100644
--- a/src/application.lisp
+++ b/src/application.lisp
@@ -48,12 +48,13 @@
(defmethod initialize-instance :after ((app application) &key)
(set-projection app)
- (with-slots (listener left right top bottom scale width height) app
+ (with-slots (listener left right top bottom scale width height scene ) app
(setf listener (make-instance 'listener)
left 0
bottom 0
top (/ height scale)
- right (/ width scale))))
+ right (/ width scale)
+ scene (make-array 0 :adjustable t :fill-pointer t :initial-element nil))))
(defun fire-blur-event-on (thing)
(when-let (blur-handlers (and thing (get-handlers-for thing 'blur)))
@@ -93,14 +94,14 @@
(let ((listener (listener app)))
(dolist (table +listener-table-slot-names+)
(setf (slot-value listener table) (make-hash-table :synchronized t))))
- (dolist (unit (application-scene app))
- (drop-unit unit)
- (cleanup unit))
+ (loop for unit across (application-scene app)
+ do
+ (drop-unit unit)
+ (cleanup unit))
(pre-exit-hooks))
(defun run-perframe (app)
- "Runs all of the handlers objects listening for perframe events, if
-those objects are currently part of the scene tree."
+ "Runs all of the handlers objects listening for perframe events if they are in the scene."
(let ((table (perframe-table (listener app)))
(time (sdl2:get-ticks)))
(loop for target being the hash-key of table
@@ -116,8 +117,9 @@ those objects are currently part of the scene tree."
(gl:clear :color-buffer-bit)
(gl:enable :blend)
(gl:blend-func :src-alpha :one-minus-src-alpha )
- (dolist (unit (reverse (application-scene app)))
- (render unit))
+ (with-slots (scene) app
+ (when (plusp (length scene))
+ (loop for unit across scene do (render unit))))
(sdl2:gl-swap-window (application-window app))
(sleep (frame-wait app)))