diff options
author | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
commit | 3a2217263d581be9a7f629b10d75aa8e3d581890 (patch) | |
tree | 23f5f0a5449a06473aba2ec7914a3c2193823a10 /src/interactive/text.lisp | |
parent | 03cdbb6a15e130a012377ab8d54074b6864e3480 (diff) | |
parent | 8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (diff) |
Merge branch 'refactor-with-def'
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))) |