X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela_draw.scm;h=da1857125e2d3310b49e85cd030448f0947f8e19;hb=16647eed5250375128894f6122be29ef15278ba3;hp=fbe21be947dde8fda0b45101b74d5988e66c0df9;hpb=b7c7d22dc3feba7710769fdb0fdc0a863718de4e;p=gacela.git diff --git a/src/gacela_draw.scm b/src/gacela_draw.scm index fbe21be..da18571 100644 --- a/src/gacela_draw.scm +++ b/src/gacela_draw.scm @@ -91,22 +91,17 @@ (glTexImage2D GL_TEXTURE_2D 0 3 width height 0 byteorder GL_UNSIGNED_BYTE (surface-pixels image)) (glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER min-filter) (glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER mag-filter) - (set-resource key - `(:id-texture ,texture :width ,real-w :height ,real-h) - (lambda () (true-load-texture filename min-filter mag-filter static)) - (lambda () (glDeleteTextures 1 `(,texture))) - :static static) - key))))))) - -(defun draw-image (filename &ptional (zoom 1)) + texture)))))) + +(define* (draw-image filename #:optional (zoom 1)) (let ((texture (load-texture filename))) (cond (texture (draw-texture texture zoom))))) -(defun draw-texture (texture &optional (zoom 1)) +(define* (draw-texture texture #:optional (zoom 1)) (cond (texture - (let ((width (getf (get-resource texture) :width)) - (height (getf (get-resource texture) :height))) - (draw-rectangle (* zoom width) (* zoom height) :texture texture))))) + (let ((width (texture-w texture)) + (height (texture-h texture))) + (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)))