diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-02-16 10:10:19 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-02-16 10:46:58 -0500 |
commit | 1c9f242098b2282f5f00efd83ff3f85e3143bb73 (patch) | |
tree | af171468d80b919cbad873d73545d38436c70ca9 /2d/texture.scm | |
parent | 0d3a3d0be9474c6a8b6dc3497ecdefdf41057a81 (diff) |
Move texture anchor procedure.
* 2d/sprite.scm (make-anchor): Delete it.
* 2d/texture.scm (anchor-texture): New procedure.
Diffstat (limited to '2d/texture.scm')
-rw-r--r-- | 2d/texture.scm | 15 |
1 files changed, 14 insertions, 1 deletions
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 ;;; |