uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 2a95c710b90f5faa9cb9d05bcdce58c78099445b
parent ab4a7313006b1209fa0ce195b3d153d6efceb867
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat,  3 Jul 2021 10:24:23 -0700

Improving the font example

Diffstat:
Mprojects/examples/demos/font.tal | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 85 insertions(+), 6 deletions(-)

diff --git a/projects/examples/demos/font.tal b/projects/examples/demos/font.tal @@ -7,17 +7,23 @@ %RTN { JMP2r } %TOS { #00 SWP } +%INCR { SWP #01 ADD SWP } +%GET-ITERATORS { SWP2k POP SWP POP } ( devices ) -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] -|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] +|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 +|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 +|a0 @File &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ( variables ) |0000 +@position + &x $2 + &y $2 + ( init ) |0100 ( -> ) @@ -29,14 +35,75 @@ ( load font ) #4000 .File/length DEO2 - ;font-path .File/name DEO2 + ;font-path-large .File/name DEO2 + ;font-data .File/load DEO2 + + ( draw label ) + #0000 #0020 ;title #21 ;draw-uf3 JSR2 + + ( load font ) + #4000 .File/length DEO2 + ;font-path-medium .File/name DEO2 + ;font-data .File/load DEO2 + + ( draw label ) + #0000 #0048 ;body #21 ;draw-uf2 JSR2 + + ( load font ) + #4000 .File/length DEO2 + ;font-path-small .File/name DEO2 ;font-data .File/load DEO2 ( draw label ) - #0000 #0030 ;body #21 ;draw-uf2 JSR2 + #0010 #00b8 ;footer #21 ;draw-uf2 JSR2 BRK +@draw-uf3 ( x* y* text* color -- ) + + STH + STH2 + .Screen/y DEO2 + .Screen/x DEO2 + STH2r + &loop + LDAk #0a ! ,&no-linebreak JCN + #0000 .Screen/x DEO2 + .Screen/y DEI2 #0018 ++ .Screen/y DEO2 + &no-linebreak + LDAk STHkr ,&sprite JSR + #0001 ++ + LDAk ,&loop JCN + POP2 POPr + RTN + + &sprite ( char color -- ) + POP + DUP TOS #0048 ** ;font-data #0100 ++ ++ .Screen/addr DEO2 + .Screen/x DEI2 .position/x STZ2 + .Screen/y DEI2 .position/y STZ2 + #00 #03 + &ver + #00 #03 + &hor + GET-ITERATORS + TOS #0008 ** .position/y LDZ2 ++ .Screen/y DEO2 + TOS #0008 ** .position/x LDZ2 ++ .Screen/x DEO2 + #21 .Screen/color DEO + .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 + INCR + LTHk ,&hor JCN + POP2 + + INCR + LTHk ,&ver JCN + POP2 + TOS ;font-data ++ LDA TOS .position/x LDZ2 ++ .Screen/x DEO2 + .position/y LDZ2 .Screen/y DEO2 + RTN + +RTN + @draw-uf2 ( x* y* text* color -- ) STH @@ -80,6 +147,9 @@ BRK RTN +@title + 5468 6520 466f 6720 486f 726e $1 + @body 4927 6c6c 206d 616b 6520 6120 736f 756e 6420 7468 6174 2773 2073 6f20 616c 6f6e @@ -96,6 +166,15 @@ RTN 6974 2069 6e20 7468 6520 6469 7374 616e 7420 746f 776e 732e 20 $1 -@font-path "projects/fonts/venice14.uf2 +@footer + 2d20 4279 2052 6179 2042 7261 6462 7572 + 79 $1 + +@font-path-large + "projects/fonts/newyork24.uf3 $1 +@font-path-medium + "projects/fonts/venice14.uf2 $1 +@font-path-small + "projects/fonts/geneva12.uf2 $1 @font-data \ No newline at end of file