diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-08-15 07:24:54 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-08-15 07:24:54 -0400 |
commit | 18e7fee572248ad7d27f811a8a868b4f6cb771fe (patch) | |
tree | 1bbac1e74c7d27354b46861dd0ee45e5ea234b0a | |
parent | af6de2c8121f00c3f96d9ba7443a217125a03dc6 (diff) |
Flip freeimage bitmaps vertically because the y-axis is the reverse of what we want.
-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)) |