diff options
author | Jona <saikyun@gmail.com> | 2017-05-05 10:36:07 +0200 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2017-06-06 21:12:14 -0400 |
commit | ecdb209d374e62144defa4b80d6a1c9f46a727d1 (patch) | |
tree | a884c7fb8ad66d7d312f10aaf3a6367630493b58 /sdl2/render.scm | |
parent | 85704a5b67bd1d1d31cd4e6ca04be488c5fe64d8 (diff) |
render: Add srcrect and dstrect arguments to render-copy.
* sdl2/bindings.scm (sdl-rect): New variable.
* sdl2/render.scm (render-copy): Add srcrect and dstrect arguments.
Diffstat (limited to 'sdl2/render.scm')
-rw-r--r-- | sdl2/render.scm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sdl2/render.scm b/sdl2/render.scm index 8c34d60..5b27990 100644 --- a/sdl2/render.scm +++ b/sdl2/render.scm @@ -122,12 +122,15 @@ color." (sdl-error "surface->texture" "failed to convert surface to texture") (wrap-texture ptr)))) -;; TODO: Add srcrect and dstrect. -(define (render-copy renderer texture) +(define (render-copy renderer texture srcrect dstrect) "Copy TEXTURE to the rendering target of RENDERER." (let ((result (ffi:sdl-render-copy (unwrap-renderer renderer) (unwrap-texture texture) - %null-pointer - %null-pointer))) + (if (nil? srcrect) + %null-pointer + (make-c-struct ffi:sdl-rect srcrect)) + (if (nil? dstrect) + %null-pointer + (make-c-struct ffi:sdl-rect dstrect))))) (unless (zero? result) (sdl-error "render-copy" "failed to copy texture")))) |