aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-28 09:04:48 -0500
committerColin Okay <colin@cicadas.surf>2022-06-28 09:04:48 -0500
commit32b46e127696aff405584e9b29f43c07feb0088d (patch)
treea911487baf834cce50e2ff5c6d017d73abb179b7 /examples
parent3527744ffd63f2d83659964d32a5a838bf83baef (diff)
[modify] text init and model matrix to support multiline
Diffstat (limited to 'examples')
-rw-r--r--examples/03-font-render.lisp26
1 files changed, 19 insertions, 7 deletions
diff --git a/examples/03-font-render.lisp b/examples/03-font-render.lisp
index 551d4ba..0f5207c 100644
--- a/examples/03-font-render.lisp
+++ b/examples/03-font-render.lisp
@@ -32,11 +32,12 @@
(ww::on-perframe ()
(let ((rot
(gethash target *spin-table* 0.0)))
- (if (< rot (* 8 pi))
+ (if (< rot (* 7.5 pi))
(setf
(gethash target *spin-table*) (+ rot 0.2)
(ww::unit-rotation target) rot)
(progn
+ (setf (ww::unit-rotation target) 0.0)
(ww::remove-handler target #'spin)
(remhash target *spin-table*))))))
@@ -48,18 +49,29 @@
(let ((hello
(make-instance
'ww::text
+ ;:content "Hell! Oh World ..."
:content (format nil "Hell!~%Oh World...")
- :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2)))))
-
- (ww::set-height-preserve-aspect hello 100)
+ :font (ww::get-asset "Ticketing.ttf" :asset-args '(:oversample 2))))
+ (instructions
+ (make-instance
+ 'ww::text
+ :content "Click to spin. Press a key to change color."
+ :font (ww::get-asset "Ticketing.ttf"))))
+
+ (ww::scale-by hello 3.0)
(setf
- (ww::unit-x hello) 100
- (ww::unit-y hello) 300)
+ (ww::unit-x hello) (* 0.5 (- 800 (ww::unit-width hello)))
+ (ww::unit-y hello) (* 0.5 (- 600 (ww::unit-height hello))))
(ww::add-handler hello #'marquee)
(ww::add-handler hello #'change-text-color)
(ww::add-handler hello #'twirl-on-click)
(ww::refocus-on hello)
- (ww::add-unit app hello)))
+ (ww::add-unit app hello)
+
+ (ww::scale-by instructions 2.0)
+ (setf
+ (ww::unit-x instructions) (* 0.5 (- 800 (ww::unit-width instructions))))
+ (ww::add-unit app instructions)))
(defun start ()