]> git.jsancho.org Git - gacela.git/commitdiff
(no commit message)
authorjsancho <devnull@localhost>
Sun, 11 Oct 2009 10:17:26 +0000 (10:17 +0000)
committerjsancho <devnull@localhost>
Sun, 11 Oct 2009 10:17:26 +0000 (10:17 +0000)
gacela.lisp
gacela_draw.lisp
gacela_ttf.lisp

index 45df43c9891388c4eb2a905a7474066d03c49eeb..8cd0da8271b25d7324862b454a0cd7054412be3f 100644 (file)
 
 
 ;;; Resources Manager
-(defstruct resource plist free-function time)
+(defstruct resource plist constructor destructor time)
 
 (defun make-resource-texture (&key filename min-filter mag-filter)
   `(:type texture :filename ,filename :min-filter ,min-filter :mag-filter ,mag-filter))
 
 (let ((resources-table (make-hash-table :test 'equal)))
 
-  (defun set-resource (key plist free-function &key static)
+  (defun set-resource (key plist constructor destructor &key static)
     (setf (gethash key resources-table)
          (make-resource :plist plist
+                        :constructor constructor
+                        :destructor destructor
                         :free-function free-function
                         :time (if static -1 (SDL_GetTicks)))))
 
index 79c3edbaf22e3785d16379588ef10003bb63316d..4c96b580808241293ca9850554bdf83885877f7a 100644 (file)
@@ -92,6 +92,7 @@
                      (SDL_FreeSurface image)
                      (set-resource key
                                    `(:id-texture ,texture :width ,real-w :height ,real-h)
+                                   (lambda () (load-texture filename :min-filter min-filter :mag-filter mag-filter :static static))
                                    (lambda () (glDeleteTextures 1 `(,texture)))
                                    :static static)
                      key)))))))))
index 6fbe4e58c958bcffc2d9b692403455cc6760ae16..0077ad42aa4c372cb5056bf9e9132c387199e9d6 100644 (file)
@@ -26,6 +26,7 @@
                    (ftglSetFontCharMap font encoding)
                    (set-resource key
                                  `(:id-font ,font)
+                                 (lambda () (open-font font-file :size size :encoding encoding :static static))
                                  (lambda () (ftglDestroyFont font))
                                  :static static)
                    key)))))))