Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setup(name)
- sx,sy = nil
- buttons = {}
- if (name == "term") then
- sx,sy = term.getSize()
- else
- m = peripheral.wrap(name)
- term.redirect(m)
- sx,sy = m.getSize()
- end
- end
- function exit()
- term.native()
- end
- function drawText(x,y,color,colorb,text)
- term.setCursorPos(x,y)
- term.setTextColor(color)
- term.setBackgroundColor(colorb)
- term.write(text)
- end
- function clearScreen()
- term.clear()
- end
- function setBackgroundColor(color)
- term.setBackgroundColor(color)
- end
- function setTextColor(color)
- term.setTextColor(color)
- end
- function drawBT(name,x,xe,y,ye,color,colorb,text)
- term.setBackgroundColor(colorb)
- term.setTextColor(color)
- for i=x,xe do
- for g=y,ye do
- term.setCursorPos(i,g)
- term.write(" ")
- end
- end
- textline = (y + ye) / 2
- textline = string.format("%.1f", textline)
- textline = tonumber(textline)
- term.setCursorPos(x,textline)
- term.write(text)
- table.insert(buttons,name..";"..x..";"..xe..";"..y..";"..ye)
- end
- function isButton(x,y)
- for i=1,#buttons do
- local parts = {}
- for word in string.gmatch(buttons[i],"[^;]+") do
- table.insert(parts,word)
- end
- name,bx,bxe,by,bye = parts[1],tonumber(parts[2]),tonumber(parts[3]),tonumber(parts[4]),tonumber(parts[5])
- if (bx-1 < x and x < bxe + 1 ) then
- if (by-1 < y and bye+1 > y) then
- return name
- end
- end
- end
- return false
- end
- function fill(x,x2,y,y2,color)
- term.setBackgroundColor(color)
- for i=x,x2 do
- for g=y,y2 do
- term.setCursorPos(i,g)
- term.write(" ")
- end
- end
- end
- function fillScreen(color)
- term.setBackgroundColor(color)
- term.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment