From 1f3c099ac8e547fa510085b935d691f24e3940dd Mon Sep 17 00:00:00 2001 From: jsancho Date: Thu, 20 Aug 2009 18:22:47 +0000 Subject: [PATCH] --- fondo_tetris.png | Bin 2083 -> 3069 bytes gacela_draw.lisp | 22 ++++++++++++++-------- gacela_tetris.lisp | 6 +++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fondo_tetris.png b/fondo_tetris.png index 627a07e2118d52519c77015b182f953fe5e1e1eb..c2530d0c52b1cf5b2fc48f76065042ebdcfa4ce9 100644 GIT binary patch literal 3069 zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sV0^&A1SHRHsa6F_Fct^7J29*~C-V}>VN3FM zcVYMsf(!O8p9~b?EbxddW?*!?PPP3{lnv>E>olr8Em)%MxGxw!B6<+&5qnVvs4@3YPM?_YOy9ol*R z^S$c#xw%qPPhS=`-rSmSg#X{mg8#E+D|ziKDk{FWvrqryfB1NN-rurZQ~jEhl1~fk zgWvp6ey=z6-)sA+Rn@ou-4^9;EZop6`zC?i`o=-NvVw&H8YWV`rhlF&w%Yyt!<~PL zuWUo}=FfiFKaQktUl$*H*4yK8xXrY{S1&)Ry@hH*(vOvy=ecS>^MlKi)BEOH?VdF~ zAa+g4%Li3!pZVSb*?5XCuKT;s=?=NS*VZbO?FhE7h=_PK`>9;S)9kHJyssrf90oPG zB6PmZlFLywYR^HMzxidK{n6EKo{6FcFntR&(SB}i^+8Vxq(TQO3f9C8(g#r` z1~&&uiH(^3!~070equ~u=9l&QC0DYy9xVUuT+Om}FaPT| z_aE*2bUm_pZ#UFQK%-f~Za}xq?EsV7>pv~^-J3os+e^KPHGxgD_Q?&{I5hRdHipq@YqBEC2iBdeF1Pb?o4 zRaPaXU2AU8`8EH4^p3p0Z09w;XKj78x5{?r{nb}4OCNvu&;C{G&)p|Qcf_rJ`}+RF zx7ObwkyvlE|N4i{g)2X9Opq_VZNK=Vr$NdLre-E)E*=d74TA*-8bC}CXTbp|2SZ#y zsh-!Q)2i%O&Y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{DK$-v;i!o;A!#K<53bXfKB=9k+TO>~GBfF(n45giQrV zfaH|~7#IXO7#cWOuxiIIO`a}fJCU7=-!5cb$Q~t67c6*yx{(b-5+*TJhzLt}Ej0!O z?<;969*=}LFd~X{e-L3MenW|jzJi7%CWcKqpHo=;bhCcnE-&U}VUU;rOfbVD^2m>J znD@!fKFCQLW*GUAia)NA?ZT1baR`%;5k|ujR;G@$u&i4(gP}nuaJHaAr?&!`wFz<( x9jNS3v+~W)4J*z9D|FccU@?cq84mjQsvk(|ujC1S2CTsuJYD@<);T3K0RVC03>E+Y 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) -- 2.39.5