-
-
Notifications
You must be signed in to change notification settings - Fork 492
Filippo edited this page May 5, 2017
·
34 revisions
print text [x=0 y=0] [color=15] [fixed=false] [scale=1] -> width
- text : any string to be printed to the screen
- x : x coordinate where to print the text
- y : y coordinate where to print the text
- color : the color to use to draw the text to the screen
- fixed : a flag indicating whether to fix the width of the characters, by default is not fixed
- scale : font scaling
- text width : returns the width of the text in pixels.
This will simply print text to the screen using the font defined in config.
-- title: print centered
-- author: Vadim
-- desc: print text perfectly centered
-- script: lua
-- input: gamepad
cls()
local string="my perfectly centered text"
local width=print(string,0,-6)
print(string,(240-width)//2,(136-6)//2)
function TIC()end
-- title: print demo
-- author: Filippo
-- desc: print matrix
-- script: lua
-- input: gamepad
-- pal:00000000ff0000e50000cc0000b200009900007f00006600004c00003300001900000000b2ffb2ccffcce5ffe5ffffff
msg="FNORD "
t=0
function TIC()
cls()
c=1
for x=0,29 do
for y=0,16 do
c=(c+1)%#msg
l=(c-math.floor(t))%#msg
print(msg:sub(l,l),x*8,y*8,y%12)
end
end
t=t+0.15
end
-- title: print demo scale
-- author: Filippo
-- desc: scale print
-- script: lua
-- input: gamepad
t=0
txt="[TIC]"
function TIC()
for i=1,15 do
local of=3*i
poke(0x3FC0+of,100+i*10)
poke(0x3FC0+of+1,i*5)
poke(0x3FC0+of+2,32+32*math.sin(t/100))
end
cls()
for z=15,0,-1 do
y=12*z*math.sin(z/5+t/50)
w=print(txt,0,-100,z,false,z)
print(txt,(240-w)/2,
68+y/1.5,
15-z,false,z)
end
t=t+1
end
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
Platform
RAM & VRAM | Display | Palette | Bits per Pixel (BPP) |
.tic
Format | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
- BDR (0.90)
- BOOT (1.0)
- MENU
- OVR (deprecated)
- SCN (deprecated)
- TIC
- btn & btnp
- circ & circb
- clip
- cls
- elli & ellib (0.90)
- exit
- fget & fset (0.80)
- font
- key & keyp
- line
- map
- memcpy & memset
- mget & mset
- mouse
- music
- peek, peek4
- peek1, peek2 (1.0)
- pix
- pmem
- poke, poke4
- poke1, poke2 (1.0)
- rect & rectb
- reset
- sfx
- spr
- sync
- ttri (1.0)
- time
- trace
- tri & trib (0.90)
- tstamp (0.80)
- vbank (1.0)