cls
очистка экрана
cls ([color]
)
Параметры:color
- индекс цвета в загруженной палитре. Начинается с нуля.
Описание:
При вызове этой функции очищается весь экран и заливается цветом указанном в качестве параметра.
По умолчанию, используется первый цвет (индекс = 0).
Как правило, вызывается из функции TIC
, но это не является обязательным условием.
Вы можете сделать какие-нибудь странные эффекты либо мерцающий экран используя её.
Подсказка:
Используйте индексы цветов свыше 15, чтобы получить специальные заполняющие паттерны.
Пример:
Запустить или скачать картридж примера.
-- title: cls demo
-- author:
-- desc:
-- script: lua
-- input: gamepad
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
Запустить или скачать картридж примера.
-- title: cls demo
-- author:
-- desc:
-- script: moon
-- input: gamepad
c=0
export TIC=->
--Use Up/Down to change color
if btnp(0) then c=c+1
if btnp(1) then c=c-1
--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'
// title: cls demo
// author:
// desc:
// script: js
// input: gamepad
c = 0
function TIC() {
//use up/down to change color
if (btnp(0)) c++
if (btnp(1)) c--
//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')
}