@@ 32,6 32,7 @@
height
layer
+ sort-with
boundary
add-child
get-child
@@ 132,7 133,10 @@
:accessor children)
(boundary :initarg :boundary
:initform nil
- :accessor boundary)))
+ :accessor boundary)
+ (sort-with :initarg :sort-with
+ :initform nil
+ :accessor sort-with)))
(defdraw (el layer)
(with-slots (boundary children) el
@@ 155,6 159,11 @@
value))
(defmethod update ((el layer) dt)
+ (when (sort-with el)
+ (sort (children el)
+ (sort-with el)
+ :key #'cdr))
+
(dolist (e (children el))
(update (cdr e) dt))
(call-next-method))