-(defun make-object (&key name class attr bhv look)
- (let ((object
- `(:name ,name :class ,class :attr ,(make-object-attributes attr) :bhv ,(make-object-behaviour bhv) :look ,look)))
- (add-object object)
- object))
+ (defun render-objects ()
+ (dolist (o active-objects) (funcall o :render))))
+
+
+(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))