summaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
authorPierre-Antoine Rouby <contact@parouby.fr>2019-05-26 13:45:00 +0200
committerDavid Thompson <dthompson2@worcester.edu>2019-05-27 20:41:01 -0400
commit277d1638bea8ed7b171cd65568962cd476686c9f (patch)
tree7a79c244e6137b873cfed53526c9189aeebc62bc /sdl2
parent9ffb8b1f126dfbf3a7e4a2d68d2e77afeca26a83 (diff)
render: Add SDL_DestroyTexture binding.
* sdl2/bindings.scm (sdl-destroy-texture): New procedure. * sdl2/render.scm (delete-texture!): New procedure. * doc/api.texi (Renderer): Document it.
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/bindings.scm3
-rw-r--r--sdl2/render.scm4
2 files changed, 7 insertions, 0 deletions
diff --git a/sdl2/bindings.scm b/sdl2/bindings.scm
index e81abf7..c382a45 100644
--- a/sdl2/bindings.scm
+++ b/sdl2/bindings.scm
@@ -243,6 +243,9 @@ RETURN-TYPE and accept arguments of ARG-TYPES."
(define-foreign sdl-create-texture-from-surface
'* "SDL_CreateTextureFromSurface" '(* *))
+(define-foreign sdl-destroy-texture
+ void "SDL_DestroyTexture" '(*))
+
(define-foreign sdl-set-render-draw-color
int "SDL_SetRenderDrawColor" (list '* uint8 uint8 uint8 uint8))
diff --git a/sdl2/render.scm b/sdl2/render.scm
index 9e4bf57..187c650 100644
--- a/sdl2/render.scm
+++ b/sdl2/render.scm
@@ -41,6 +41,7 @@
render-draw-line
render-draw-point
+ destroy-texture!
surface->texture))
@@ -138,6 +139,9 @@ color."
(sdl-error "surface->texture" "failed to convert surface to texture")
(wrap-texture ptr))))
+(define (delete-texture! texture)
+ "Free the memory used by TEXTURE."
+ (ffi:sdl-destroy-texture (unwrap-texture texture)))
(define* (render-copy renderer texture
#:key (angle 0) srcrect dstrect center)