aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/application.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-22 11:58:16 -0500
committerColin Okay <colin@cicadas.surf>2022-07-22 11:58:16 -0500
commit00841605110612f6e7f3bbfc054ceff980bf25be (patch)
tree1f16b86d5c555eea22e60cb2d36f88682bd9023b /src/application.lisp
parent6d9b8b48423dba99ecdba004f260c30e6717b6a6 (diff)
[version] [refactor] [redesign] removed containers
Diffstat (limited to 'src/application.lisp')
-rw-r--r--src/application.lisp17
1 files changed, 9 insertions, 8 deletions
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)))
+