Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drawscreen(color)
- if color == nil then
- write("Error: nil color!")
- else
- term.setBackgroundColor(color)
- term.clear()
- term.setCursorPos(0, 0)
- term.setBackgroundColor(colors.black)
- end
- end
- function drawTextBox(x, y, bg, text)
- if bg == nil then
- write("Error: Nil bg!")
- else
- if y == nil then
- write("Error: Nil y!")
- else
- if x == nil then
- write("Error: Nil x!")
- else
- if text == nil then
- write("Error: Nil Text!")
- else
- term.setBackgroundColor(bg)
- term.setCursorPos(x, y)
- local text1 = tostring(text)
- write(text1)
- term.setBackgroundColor(colors.black)
- end
- end
- end
- end
- end
- function drawImage(path, x, y)
- if y == nil then
- write("Error: Nil y!")
- else
- if x == nil then
- write("Error: Nil x!")
- else
- if path == nil then
- write("Error: Nil path!")
- else
- local image = paintutils.loadImage(path)
- paintutils.drawImage(image, x, y)
- end
- end
- end
- end
- function cdrawTextBox(txt, color)
- if color == nil then
- print("Error: Nil color!")
- else
- if txt == nil then
- print("Error: Nil text!")
- else
- local w,h = term.getSize()
- midw, midh = math.floor(w-#txt)/2,math.floor(h/2)
- term.setCursorPos(midw,midh)
- term.setBackgroundColor(color)
- write(txt)
- while true do
- local event, button, cx, cy = os.pullEvent("mouse_click")
- if cx >= midw and cx < txt:len() and cy == midh then
- --code after button clicked
- --end code after button clicked
- break
- end
- end
- end
- end
- end
- function drawDesktopImg(path)
- local image = paintutils.loadImage(path)
- paintutils.drawImage(image, 1, 1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement