From f8cbe6fdced276cf0ce70c14c78bc2f5cfb4d8ee Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 10 Nov 2017 21:23:01 -0500 Subject: render: Fix broken render-copy procedure. * sdl2/render.scm (render-copy): Make srcrect and dstrect optional and do not use nil? to check them. --- sdl2/render.scm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdl2/render.scm b/sdl2/render.scm index 5b27990..44df4a4 100644 --- a/sdl2/render.scm +++ b/sdl2/render.scm @@ -122,15 +122,15 @@ color." (sdl-error "surface->texture" "failed to convert surface to texture") (wrap-texture ptr)))) -(define (render-copy renderer texture srcrect dstrect) +(define* (render-copy renderer texture #:key srcrect dstrect) "Copy TEXTURE to the rendering target of RENDERER." (let ((result (ffi:sdl-render-copy (unwrap-renderer renderer) (unwrap-texture texture) - (if (nil? srcrect) - %null-pointer - (make-c-struct ffi:sdl-rect srcrect)) - (if (nil? dstrect) - %null-pointer - (make-c-struct ffi:sdl-rect dstrect))))) + (if srcrect + (make-c-struct ffi:sdl-rect srcrect) + %null-pointer) + (if dstrect + (make-c-struct ffi:sdl-rect dstrect) + %null-pointer)))) (unless (zero? result) (sdl-error "render-copy" "failed to copy texture")))) -- cgit v1.2.3