diff options
Diffstat (limited to 'src/interactive/text.lisp')
-rw-r--r-- | src/interactive/text.lisp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/interactive/text.lisp b/src/interactive/text.lisp index d79f7bf..73e25e4 100644 --- a/src/interactive/text.lisp +++ b/src/interactive/text.lisp @@ -2,13 +2,13 @@ (in-package #:wheelwork) -(defclass/std text (unit interactive) - ((font :with :ri :std (error "A font is required") :type font) - (content :with :ri :std "") - (color :with :std #(1.0 1.0 1.0 1.0)) - (vao elem-count newlines :r) - (shader :with :static :r))) - +(def:class text (unit interactive) + (font :prefix :ro :required :type font) + (content :prefix :ro :type string :initform "") + ((color "RGBA values") + :prefix :type (vector float 4) :initform (vector 1.0 1.0 1.0 1.0)) + (vao elem-count newlines :ro :type (unsigned-byte 32)) + (shader :prefix :ro :allocation :class)) (defmethod model-matrix ((text text)) (let ((m (mat:meye 4))) @@ -19,20 +19,23 @@ (* newlines text-height)) (rotation-baseline-offset (* 2 newlines text-height ))) - (mat:nmtranslate m (vec:vec x - (+ y - (* - scale-y - baseline-offset)) - 0.0)) + (mat:nmtranslate + m (vec:vec x + (+ y + (* + scale-y + baseline-offset)) + 0.0)) - (mat:nmtranslate m (vec:v* 0.5 (vec:vec (* scale-x base-width) - (* scale-y (- base-height rotation-baseline-offset) ) - 0.0))) + (mat:nmtranslate + m (vec:v* 0.5 (vec:vec (* scale-x base-width) + (* scale-y (- base-height rotation-baseline-offset) ) + 0.0))) (mat:nmrotate m vec:+vz+ rotation) - (mat:nmtranslate m (vec:v* -0.5 (vec:vec (* scale-x base-width ) - (* scale-y (- base-height rotation-baseline-offset)) - 0.0)))) + (mat:nmtranslate + m (vec:v* -0.5 (vec:vec (* scale-x base-width ) + (* scale-y (- base-height rotation-baseline-offset)) + 0.0)))) (mat:nmscale m (vec:vec scale-x scale-y 1.0)) m))) |