Support for Lisp implementations where integers are not (eq)

This commit is contained in:
~keith 2022-02-23 23:35:35 +00:00
parent 8d70a235db
commit 3d9818264e
Signed by: keith
GPG Key ID: 5BEBEEAB2C73D520
5 changed files with 5 additions and 26 deletions

View File

@ -36,7 +36,6 @@
nconc `(,key ,value) into make-params
finally (return (values other-forms make-params))))
#|
(define-new!-impl component (class it params)
(loop for (key value) on params by #'cddr
if (eq key :actor)
@ -44,23 +43,3 @@
else
nconc `(,key ,value) into make-params
finally (return (values other-forms make-params))))
|#
#|
(defmacro actor! (class &rest params &key &allow-other-keys)
(let* ((cons-form `(make-instance ',class))
(it (gensym))
(other-forms
(loop for (key value) on params by #'cddr
if (eq key :component)
collect `(o! ,it (add-component ,value))
else
if (eq key :child)
collect `(o! ,it (add-child ,value))
else
do (nconc cons-form `(,key ,value)))))
`(let ((,it ,cons-form)) ,@other-forms ,it)))
(defmacro component! (class &rest params &key &allow-other-keys)
`(make-instance ',class ,@params))
|#

View File

@ -120,7 +120,7 @@
(error "~S is already a child of ~S" child (o! child parent)))
(unless (find-if (lambda (x) (etypecase x
(actor (eq x child))
(id-ref (eq (id-ref-actor x) (o! child id)))))
(id-ref (eql (id-ref-actor x) (o! child id)))))
(o! this :slot children))
(push child (o! this :slot children)))
(setf (o! child :slot parent) (make-weak-pointer this))
@ -134,7 +134,7 @@
(setf (o! this :slot children)
(delete-if (lambda (x) (etypecase x
(actor (eq x child))
(id-ref (eq (id-ref-actor x) (o! child id)))))
(id-ref (eql (id-ref-actor x) (o! child id)))))
(o! this :slot children) :count 1))
(setf (o! child :slot parent) nil)
(o! child (parent-changed))

View File

@ -154,4 +154,4 @@
(defun get-scene (scene-id)
"Get a scene by its ID."
(find-if (lambda (scene) (eq (o! scene id) scene-id)) *world-scenes*))
(find-if (lambda (scene) (eql (o! scene id) scene-id)) *world-scenes*))

View File

@ -159,7 +159,7 @@
for view = (ensure-live (weak-pointer-value view-ptr))
when (and (o! view active-p) (o! view actor tree-active-p))
do (progn
(unless (eq (o! view render-pass) render-pass)
(unless (eql (o! view render-pass) render-pass)
(setf render-pass (o! view render-pass))
(gl:clear :depth-buffer))
(o! view (render-view *world-drawables*)))))

View File

@ -48,7 +48,7 @@
(defmethod get-actor ((this scene) actor-id)
"Get the actor with the specified ID in this scene."
(find-if (lambda (actor) (eq (o! actor id) actor-id)) (o! this actors)))
(find-if (lambda (actor) (eql (o! actor id) actor-id)) (o! this actors)))
(defmethod get-tagged-actors ((this scene) tags)
"Get all actors tagged with the given set of tags."