summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-18 08:01:11 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-18 08:01:11 -0400
commit38e5866d32a355a7ef881e77650882aed5e32834 (patch)
treec0f81a560ca582a9aa67c5418c035daea518d461 /2d
parent40edffee940f8304b4f06640a060a2b3951c1506 (diff)
Change render-font procedure.
Diffstat (limited to '2d')
-rw-r--r--2d/font.scm50
1 files changed, 37 insertions, 13 deletions
diff --git a/2d/font.scm b/2d/font.scm
index 80e90da..4aef6da 100644
--- a/2d/font.scm
+++ b/2d/font.scm
@@ -26,14 +26,11 @@
#:use-module (srfi srfi-9)
#:use-module (system foreign)
#:use-module (2d wrappers ftgl)
- #:use-module (2d color)
- #:export (<font>
- make-font
- font?
- font-ftgl-font
- font-size
- load-font
- render-font))
+ #:use-module (2d color))
+
+;;;
+;;; Font
+;;;
;; Font objects represent an FTGL texture font at a given size.
(define-record-type <font>
@@ -48,8 +45,35 @@
(ftgl-set-font-face-size ftgl-font size 72)
(make-font ftgl-font size)))
-(define (render-font font text color alignment)
- (apply-color color)
- (ftgl-render-font (font-ftgl-font font)
- text
- (ftgl-render-mode all)))
+(define (render-font font text x y color alignment)
+ (with-gl-push-matrix
+ (gl-translate x y 0)
+ (apply-color color)
+ (ftgl-render-font (font-ftgl-font font)
+ text
+ (ftgl-render-mode all))))
+
+(export <font>
+ make-font
+ font?
+ font-ftgl-font
+ font-size
+ load-font
+ render-font)
+
+;;;
+;;; Textbox
+;;;
+
+;; A textbox is a string of text wrapped within certain dimensions.
+;; (define-record-type <textbox>
+;; (%make-textbox text layout)
+;; textbox?
+;; (text textbox-text)
+;; (layout textbox-layout))
+
+;; (define (make-textbox font text rect)
+;; (let ((layout (ftgl-create-simple-layout)))
+;; (ftgl-set-layout-font font)
+;; (ftgl-set-layout-alignment (ftgl-text-alignment left))
+;; (ftgl-set-layout-line-length (rect-width rect))))