From 1c9f242098b2282f5f00efd83ff3f85e3143bb73 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 16 Feb 2014 10:10:19 -0500 Subject: Move texture anchor procedure. * 2d/sprite.scm (make-anchor): Delete it. * 2d/texture.scm (anchor-texture): New procedure. --- 2d/texture.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to '2d/texture.scm') diff --git a/2d/texture.scm b/2d/texture.scm index 684ad42..5185368 100644 --- a/2d/texture.scm +++ b/2d/texture.scm @@ -28,6 +28,7 @@ #:use-module (figl contrib packed-struct) #:use-module (2d color) #:use-module (2d helpers) + #:use-module (2d vector2) #:use-module (2d wrappers gl) #:use-module (2d wrappers freeimage) #:export (make-texture @@ -42,7 +43,7 @@ texture-t1 texture-s2 texture-t2 - surface->texture + anchor-texture texture-vertex pack-texture-vertices draw-texture-vertices)) @@ -154,6 +155,18 @@ that will be rendered, in pixels." (freeimage-unload bitmap) texture)) +(define (anchor-texture texture anchor) + "Return a vector2 of the coordinates for the center point of a +texture." + (cond + ((vector2? anchor) + anchor) + ((eq? anchor 'center) + (vector2 (/ (texture-width texture) 2) + (/ (texture-height texture) 2))) + (else + (error "Invalid anchor type!" anchor)))) + ;;; ;;; Texture Vertices ;;; -- cgit v1.2.3