(defun make-resource-texture (&key filename min-filter mag-filter)
`(:type texture :filename ,filename :min-filter ,min-filter :mag-filter ,mag-filter))
-(defun make-resource-font (&key filename size encoding)
- `(:type font :filename ,filename :size ,size :enconding ,encoding))
+(defun make-resource-font (&key filename encoding)
+ `(:type font :filename ,filename :enconding ,encoding))
(let ((resources-table (make-hash-table :test 'equal)))
(t (fill (cons (make-list 14) grid) (- n 1))))))
(fill res (- 20 (length res))))))
+(let ((points 0))
+ (defun get-points ()
+ points))
+
(let ((tetramine (random-tetramine)) (x 6) (y 0)
(next (random-tetramine))
(timer (make-timer))
(grid (make-list 20 :initial-element (make-list 14)))
(background (draw-image-function "fondo_tetris.png"))
- (font (load-font "lazy.ttf")))
+ (font (load-font "lazy.ttf" :size 20)))
(defun tetramine ()
(cond ((eq (timer-state timer) 'stopped) (start-timer timer)))
(in-package :gacela)
-(defun load-font (font-file &key (size 80) (encoding ft_encoding_unicode) static)
- (let ((key (make-resource-font :filename font-file :size size :encoding encoding)))
- (cond ((get-resource key) key)
+(defun load-font (font-file &key (size 40) (encoding ft_encoding_unicode) static)
+ (let* ((key (make-resource-font :filename font-file :encoding encoding))
+ (res (get-resource key)))
+ (cond (res (ftglSetFontFaceSize (getf res :id-font) size 72)
+ key)
(t (true-load-font font-file size encoding static)))))
(defun true-load-font (font-file size encoding static)
- (let ((key (make-resource-font :filename font-file :size size :encoding encoding))
+ (let ((key (make-resource-font :filename font-file :encoding encoding))
(font (ftglCreateTextureFont font-file)))
(cond ((/= font 0)
(ftglSetFontFaceSize font size 72)
(ftglSetFontCharMap font encoding)
(set-resource key
`(:id-font ,font)
- (lambda () (true-load-font font-file size encoding static))
+ (lambda () (true-load-font font-file encoding static))
(lambda () (ftglDestroyFont font))
:static static)
key))))
-(defun render-text (text font)
- (ftglRenderFont (getf (get-resource font) :id-font) text FTGL_RENDER_ALL))
+(defun render-text (text font &key size)
+ (let ((id-font (getf (get-resource font) :id-font)))
+ (cond (size (ftglSetFontFaceSize id-font size 72)))
+ (ftglRenderFont id-font text FTGL_RENDER_ALL)))