Skip to content
BADIM-PC\Vadim edited this page Mar 22, 2017 · 16 revisions

cls

cls[color]

Parameters:

  • color : a zero based int as index of the color in the palette loaded

Description:

When called this function clear all the screen using the color passed as argument.
If no parameter is passed first color (0) is used.
Usually is called inside TIC() function, but it's not mandatory. You can make some strange effect by avoid calling it, or use it to "flash" the screen when some events occur.

Tips: Use a color over 15 to see some special fill pattern

Example:

-- 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
Clone this wiki locally