From 32b46e127696aff405584e9b29f43c07feb0088d Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Tue, 28 Jun 2022 09:04:48 -0500 Subject: [modify] text init and model matrix to support multiline --- examples/03-font-render.lisp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'examples/03-font-render.lisp') 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 () -- cgit v1.2.3