diff options
Diffstat (limited to '2d')
-rw-r--r-- | 2d/texture.scm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/2d/texture.scm b/2d/texture.scm index 76c5b92..79c4b55 100644 --- a/2d/texture.scm +++ b/2d/texture.scm @@ -129,13 +129,18 @@ (freeimage-get-height bitmap) 0 0 1 1))) +(define (load-bitmap filename) + (let* ((bitmap (freeimage-load (freeimage-get-file-type filename) filename)) + (32bit-bitmap (freeimage-convert-to-32-bits bitmap))) + (freeimage-unload bitmap) + (freeimage-flip-vertical 32bit-bitmap) + 32bit-bitmap)) + (define (load-texture filename) "Loads a texture from a file." - (let* ((bitmap (freeimage-load (freeimage-get-file-type filename) filename)) - (32bit-bitmap (freeimage-convert-to-32-bits bitmap)) - (texture (bitmap->texture 32bit-bitmap))) + (let* ((bitmap (load-bitmap filename)) + (texture (bitmap->texture bitmap))) (freeimage-unload bitmap) - (freeimage-unload 32bit-bitmap) texture)) (define* (draw-texture texture x y #:optional (color #xffffffff)) |