+(defmacro make-object (name attr bhv &body look)
+ `(progn
+ (let ((attr ,(cond (attr (cons 'list (make-object-attributes attr)))))
+ (bhv ,(cond (bhv (cons 'list (make-object-behaviour bhv))))))
+ (defun ,name (option &rest param)
+ (case option
+ (:action (dolist (b bhv t) (setq attr (funcall (get-behaviour-fun-name b) attr))))
+ (:get-attr attr)
+ (:get-bhv bhv)
+ (:set-bhv (setq bhv (car param)))
+ (:render (glPushMatrix)
+ ,@(mapcar (lambda (x) (if (stringp x) `(draw-image ,x) x)) look)
+ (glPopMatrix)))))
+ (add-object ',name)
+ ',name))
+
+(defun make-object-attributes (attr)
+ (cond ((or (null attr) (atom attr)) nil)
+ (t (let ((rest (make-object-attributes (cdr attr)))
+ (this (object-attribute-definition (car attr))))
+ (setf (getf rest (car this)) (cadr this))
+ rest))))
+
+(defun object-attribute-definition (attribute)
+ (let* ((name (cond ((listp attribute) (car attribute))
+ (t attribute)))
+ (pname (attribute-name name))
+ (value (cond ((listp attribute) (cadr attribute)))))
+ `(,pname ,value)))