X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_tetris.lisp;h=200c4faa5e56316a30f1e22b0c59cd82fa74ad3a;hb=e5735ab84c379b88a404c9d6d9fd4784e55260ea;hp=3397a91612ad0612bdfd56a42aee653bd5a70d16;hpb=485e401435dd0c9d443299cb04b1576e0f15f43f;p=gacela.git diff --git a/gacela_tetris.lisp b/gacela_tetris.lisp index 3397a91..200c4fa 100644 --- a/gacela_tetris.lisp +++ b/gacela_tetris.lisp @@ -1,6 +1,6 @@ (in-package :gacela) -(setq *zoom* -50) +(set-frames-per-second 15) (defun tetramine-i () (let ((color '(1 0 0))) @@ -48,13 +48,13 @@ (defun draw-cell (cell) (cond ((null cell) nil) - (t (draw-color cell) (draw-square :size 0.9)))) + (t (with-color cell (draw-square :size 20))))) (defun draw-row (row) - (mapcar (lambda (cell) (draw-cell cell) (translate 2 0)) row)) + (mapcar (lambda (cell) (draw-cell cell) (translate 23 0)) row)) (defun draw-grid (grid) - (mapcar (lambda (row) (draw-row row) (translate (* -2 (length row)) -2)) grid)) + (mapcar (lambda (row) (draw-row row) (translate (* -23 (length row)) -23)) grid)) (defun join-rows (source destination &optional (offset 0)) (cond ((null source) destination) @@ -129,10 +129,16 @@ (setq next (random-tetramine))) (t (incf y) (start-timer timer))))) - (funcall background 0.086))) -; (translate -25 19) -; (draw-grid (join-grids tetramine grid x y)) -; (translate 40 40) -; (draw-grid next))) - -(run-game "Gacela Tetris" (tetramine)) + (funcall background) + (translate -288 218) + (draw-grid (join-grids tetramine grid x y)) + (translate 440 440) + (draw-grid next))) + +(let ((frame 0.0) (fps (make-timer)) (update (make-timer))) + (start-timer update) + (start-timer fps) + (run-game "Gacela Tetris" + (tetramine) + (incf frame) + (cond ((> (get-time update) 1000) (print (/ frame (/ (get-time fps) 1000.0))) (start-timer update)))))