Update of /project/corman-sdl/cvsroot/corman-sdl/engine In directory common-lisp.net:/tmp/cvs-serv2445/engine
Modified Files: engine.lisp Added Files: use-engine.lisp Log Message:
Date: Thu Jul 8 02:00:13 2004 Author: lcrook
Index: corman-sdl/engine/engine.lisp diff -u corman-sdl/engine/engine.lisp:1.8 corman-sdl/engine/engine.lisp:1.9 --- corman-sdl/engine/engine.lisp:1.8 Mon May 3 23:00:53 2004 +++ corman-sdl/engine/engine.lisp Thu Jul 8 02:00:12 2004 @@ -95,9 +95,6 @@ start end)
- - - (let ((bitplanes nil)) (defun bitplanes () bitplanes) @@ -115,6 +112,9 @@ (y :accessor sprite-y :initform 0 :initarg :y) (zorder :accessor sprite-zorder :initform 0 :initarg :zorder)))
+(defun new-bitplane (zorder) + (make-bitplane :zorder zorder)) + (defun addto-bitplane (bitplane obj) (cond ((null (bitplane-end bitplane)) @@ -123,15 +123,23 @@ (t (setf (bitplane-end bitplane) (dl-append obj (bitplane-end bitplane))))))
-(defun removefrom-bitplane (bitplane obj) +;Removes a node from the bitplane. +(defun remove-node-from-bitplane (bitplane obj) (when (null (dl-next obj)) (setf (bitplane-end bitplane) (dl-prev obj))) (when (null (dl-prev obj)) (setf (bitplane-start bitplane) (dl-next obj))) (dl-remove obj))
-(defun new-bitplane (zorder) - (make-bitplane :zorder zorder)) +;Finds the node containing object, then calls remove-node-from-bitplane +(defun remove-from-bitplane (bitplane object) + (let ((obj (dl-find (bitplane-start bitplane) + #'(lambda (node) + (if (equal (dl-data node) object) + node + nil))))) + (when obj + (remove-node-from-bitplane bitplane obj))))
(defun get-zorder (obj) (cond