summaryrefslogtreecommitdiff
path: root/2d/texture.scm
diff options
context:
space:
mode:
Diffstat (limited to '2d/texture.scm')
-rw-r--r--2d/texture.scm15
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
;;;