-
-
Notifications
You must be signed in to change notification settings - Fork 488
cls([color=0])
- color : index (0..15) of a color in the current palette (defaults to 0)
This function clears/fills the entire screen using color. If no parameter is passed, index 0 of the palette is used.
The function is often called inside TIC(), clearing the screen before each frame, but this is not mandatory. If you're drawing to the entire screen each frame (for example with sprites, the map or primitive shapes) there is no need to clear the screen beforehand however it can result in annoying artifacts.
Tip: You can create some interesting effects by not calling cls(), allowing frames to stack on top of each other - or using it repeatedly to "flash" the screen when some special event occurs.
-- cls demo
c=0
function TIC()
--Use Up/Down to change color
if btnp(0) then c=c+1 end
if btnp(1) then c=c-1 end
--Clear with the color
cls(c)
--Make a background for the text
rect(0,0,240,8,0)
--Ouput a text with function call
print('cls('..c..') --Use Up/Down to change color')
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)