- (let ((width (getf (get-resource texture) :width))
- (height (getf (get-resource texture) :height)))
- (draw-rectangle (* zoom width) (* zoom height) :texture texture)))))
-
-(defun draw-quad (v1 v2 v3 v4 &key texture)
- (let ((id-texture (getf (get-resource texture) :id-texture)))
- (cond (id-texture
- (progn-textures
- (glBindTexture GL_TEXTURE_2D id-texture)
- (begin-draw 4)
- (draw-vertex v1 :texture-coord '(0 0))
- (draw-vertex v2 :texture-coord '(1 0))
- (draw-vertex v3 :texture-coord '(1 1))
- (draw-vertex v4 :texture-coord '(0 1))
- (glEnd)))
- ((consp texture) (with-color texture (draw v1 v2 v3 v4)))
- (t (draw v1 v2 v3 v4)))))
-
-(defun draw-rectangle (width height &key texture)
- (let* ((w (/ width 2)) (-w (neg w)) (h (/ height 2)) (-h (neg h)))
- (draw-quad (list -w h 0) (list w h 0) (list w -h 0) (list -w -h 0) :texture texture)))
-
-(defun draw-square (&key (size 1) texture)
- (draw-rectangle size size :texture texture))
-
-(defun draw-cube (&key (size 1) texture texture-1 texture-2 texture-3 texture-4 texture-5 texture-6)
- (let ((-size (neg size)))
+ (let ((width (texture-w texture))
+ (height (texture-h texture)))
+ (draw-rectangle (* zoom width) (* zoom height) #:texture texture)))))
+
+(define* (draw-line length #:optional color)
+ (let ((l (/ length 2)))
+ (cond (color
+ (with-color color (draw (list 0 l) (list 0 (- l)))))
+ (else
+ (draw (list 0 l) (list 0 (- l)))))))
+
+(define* (draw-quad v1 v2 v3 v4 #:key texture color)
+ (cond (texture
+ (progn-textures
+ (glBindTexture GL_TEXTURE_2D texture)
+ (begin-draw 4)
+ (draw-vertex v1 #:texture-coord '(0 0))
+ (draw-vertex v2 #:texture-coord '(1 0))
+ (draw-vertex v3 #:texture-coord '(1 1))
+ (draw-vertex v4 #:texture-coord '(0 1))
+ (glEnd)))
+ (color
+ (with-color color (draw v1 v2 v3 v4)))
+ (else
+ (draw v1 v2 v3 v4))))
+
+(define* (draw-rectangle width height #:key texture color)
+ (let ((w (/ width 2)) (h (/ height 2)))
+ (draw-quad (list (- w) h 0)
+ (list w h 0)
+ (list w (- h) 0)
+ (list (- w) (- h) 0)
+ #:texture texture
+ #:color color)))
+
+(define* (draw-square #:key (size 1) texture color)
+ (draw-rectangle size size #:texture texture #:color color))
+
+(define* (draw-cube #:key (size 1)
+ texture texture-1 texture-2 texture-3 texture-4 texture-5 texture-6
+ color color-1 color-2 color-3 color-4 color-5 color-6)
+ (let ((-size (- size)))