X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_draw.lisp;h=7a6dca6e08e3c9782b1cd233b74418bbc266baec;hb=b4bb1b1a7180f521bceb564003d906308f93b5b7;hp=feaf0c39d75b063c6275e3396cf9637e8537a39e;hpb=1f3c099ac8e547fa510085b935d691f24e3940dd;p=gacela.git diff --git a/gacela_draw.lisp b/gacela_draw.lisp index feaf0c3..7a6dca6 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -56,7 +56,9 @@ (defun draw-image-function (filename) (multiple-value-bind (texture width height) (load-texture filename) - (cond (texture)))) + (cond (texture + (lambda (&optional (f 1)) + (draw-rectangle (* f width) (* f height) :texture texture)))))) (defun draw-quad (v1 v2 v3 v4 &key texture color) (cond (texture (glBindTexture GL_TEXTURE_2D texture) @@ -69,9 +71,12 @@ (t (cond (color (draw-color color))) (draw v1 v2 v3 v4)))) -(defun draw-square (&key size texture color) - (let ((-size (neg size))) - (draw-quad (list -size size 0) (list size size 0) (list size -size 0) (list -size -size 0) :texture texture :color color))) +(defun draw-rectangle (width height &key texture color) + (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 :color color))) + +(defun draw-square (&key (size 1) texture color) + (draw-rectangle size size :texture texture :color color)) (defun draw-cube (&key size texture color) (let ((-size (neg size)))