From: jsancho Date: Thu, 20 Aug 2009 18:22:47 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=1f3c099ac8e547fa510085b935d691f24e3940dd;p=gacela.git --- diff --git a/fondo_tetris.png b/fondo_tetris.png index 627a07e..c2530d0 100644 Binary files a/fondo_tetris.png and b/fondo_tetris.png differ diff --git a/gacela_draw.lisp b/gacela_draw.lisp index 3149f4d..feaf0c3 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -42,15 +42,21 @@ (defun load-texture (filename &optional (min-filter GL_LINEAR) (mag-filter GL_LINEAR)) (init-textures) (init-video-mode) - (let ((image (IMG_Load filename)) - (texture (car (glGenTextures 1)))) + (let ((image (IMG_Load filename))) (cond ((/= image 0) - (glBindTexture GL_TEXTURE_2D texture) - (glTexImage2D GL_TEXTURE_2D 0 3 (surface-w image) (surface-h image) 0 GL_BGR 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) - (SDL_FreeSurface image))) - texture)) + (let ((width (surface-w image)) (height (surface-h image)) + (texture (car (glGenTextures 1)))) + (glBindTexture GL_TEXTURE_2D texture) + (glTexImage2D GL_TEXTURE_2D 0 3 width height 0 GL_RGB 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) + (SDL_FreeSurface image) + (values texture width height)))))) + +(defun draw-image-function (filename) + (multiple-value-bind + (texture width height) (load-texture filename) + (cond (texture)))) (defun draw-quad (v1 v2 v3 v4 &key texture color) (cond (texture (glBindTexture GL_TEXTURE_2D texture) diff --git a/gacela_tetris.lisp b/gacela_tetris.lisp index c0e7a38..4bd3819 100644 --- a/gacela_tetris.lisp +++ b/gacela_tetris.lisp @@ -1,6 +1,6 @@ (in-package :gacela) -(setq *zoom* -10) +(setq *zoom* -50) (defun tetramine-i () (let ((color '(1 0 0))) @@ -103,7 +103,7 @@ (next (random-tetramine)) (timer (make-timer)) (grid (make-list 20 :initial-element (make-list 14))) - (texture (load-texture "background.bmp")));fondo_tetris.png"))) + (texture (load-texture "fondo_tetris.png"))) (defun tetramine () (cond ((eq (timer-state timer) 'stopped) (start-timer timer))) @@ -129,7 +129,7 @@ (setq next (random-tetramine))) (t (incf y) (start-timer timer))))) - (draw-square :size 1 :texture texture))) + (draw-square :size 20 :texture texture))) ; (translate -25 19) ; (draw-grid (join-grids tetramine grid x y)) ; (translate 40 40)