From 00841605110612f6e7f3bbfc054ceff980bf25be Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 22 Jul 2022 11:58:16 -0500 Subject: [version] [refactor] [redesign] removed containers --- src/application.lisp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/application.lisp') diff --git a/src/application.lisp b/src/application.lisp index ef5e92f..ea37525 100644 --- a/src/application.lisp +++ b/src/application.lisp @@ -2,8 +2,7 @@ (in-package #:wheelwork) - -(defclass/std application (container interactive) +(defclass/std application (region interactive) ((title :with :ri :std "Wheelwork App") (asset-root :ri :std #P"./" :doc "Directory under which assets are stored.") (asset-classifiers @@ -28,7 +27,7 @@ :doc "determines whether the search for event handlers stops at the first visible unit under the xy position of the mouse or not. ") - (focus last-motion-target :with :a) + (scene focus last-motion-target :with :a) (fps :std 30 :doc "Frames Per Second") (frame-wait :r)) (:documentation "The application contains the information and data @@ -56,8 +55,6 @@ top (/ height scale) right (/ width scale)))) - - (defun fire-blur-event-on (thing) (when-let (blur-handlers (and thing (get-handlers-for thing 'blur))) (dolist (handler blur-handlers) @@ -97,7 +94,9 @@ (let ((listener (listener app))) (dolist (table +listener-table-slot-names+) (setf (slot-value listener table) (make-hash-table :synchronized t)))) - (call-next-method) + (dolist (unit (application-scene app)) + (drop-unit unit) + (cleanup unit)) (trivial-garbage:gc :full t)) (defun run-perframe (app) @@ -108,7 +107,7 @@ those objects are currently part of the scene tree." (loop for target being the hash-key of table for handlers = (slot-value (listener target) 'perframe) ;; only fire perframe when target is in scene - when (or (eq app target) (unit-container target)) + when (or (eq app target) (unit-in-scene-p target)) do (loop for handler in handlers do (funcall handler target time))))) (defmethod render ((app application)) @@ -118,6 +117,8 @@ 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 ) - (call-next-method) + (dolist (unit (application-scene app)) + (render unit)) (sdl2:gl-swap-window (application-window app)) (sleep (frame-wait app))) + -- cgit v1.2.3