summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/texture.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/chickadee/graphics/texture.scm b/chickadee/graphics/texture.scm
index 94ce546..dd2a6d8 100644
--- a/chickadee/graphics/texture.scm
+++ b/chickadee/graphics/texture.scm
@@ -245,7 +245,8 @@ HEIGHT, 32 bit color bytevector."
(bytevector-copy! pixels source-start buffer target-start row-width)))
buffer))
-(define (surface->texture surface min-filter mag-filter wrap-s wrap-t transparent-color)
+(define (surface->texture surface min-filter mag-filter wrap-s wrap-t
+ transparent-color flip?)
"Convert SURFACE, an SDL2 surface object, into a texture that uses
the given MIN-FILTER and MAG-FILTER."
;; Convert to 32 bit RGBA color.
@@ -266,7 +267,9 @@ the given MIN-FILTER and MAG-FILTER."
(= g (bytevector-u8-ref pixels (+ i 1)))
(= b (bytevector-u8-ref pixels (+ i 2))))
(bytevector-u8-set! pixels (+ i 3) 0)))))
- (make-texture (flip-pixels-vertically pixels width height)
+ (make-texture (if flip?
+ (flip-pixels-vertically pixels width height)
+ pixels)
width height
#:min-filter min-filter
#:mag-filter mag-filter
@@ -278,7 +281,8 @@ the given MIN-FILTER and MAG-FILTER."
(mag-filter 'nearest)
(wrap-s 'repeat)
(wrap-t 'repeat)
- transparent-color)
+ transparent-color
+ (flip? #t))
"Load a texture from an image in FILE. MIN-FILTER and MAG-FILTER
describe the method that should be used for minification and
magnification. Valid values are 'nearest and 'linear. By default,
@@ -286,7 +290,7 @@ magnification. Valid values are 'nearest and 'linear. By default,
(sdl2:call-with-surface (sdl2:load-image file)
(lambda (surface)
(surface->texture surface min-filter mag-filter wrap-s wrap-t
- transparent-color))))
+ transparent-color flip?))))
;;;