asteroidsteam icon

guiapi

asteroidsteam | PRO | 12/13/16 06:53:11 PM UTC | 0 ⭐ | 648 👁️ | Never ⏰ | []
Lua |

1.49 KB

|

None

|

0 👍

/

0 👎

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

Comments