Advertisement
thegreatstudio

oos

May 15th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. local X, Y = term.getSize()
  2.  
  3. function clear()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. end
  7.  
  8. function cPrint(str, ypos)
  9.         term.setCursorPos(x/2-#str/2, ypos)
  10.         term.write(str)
  11. end
  12.  
  13.  
  14. function drawButton(x, y, text, color)
  15.         local curX, curY = term.getCursorPos()
  16.         paintutils.drawLine(x, y, x + #text + 1, y, color)
  17.         term.setCursorPos(x + 1, y)
  18.         print(text)
  19.         term.setCursorPos(curX, curY)
  20. end
  21.  
  22. function getMouseClick(sec, x1, y1, x2, y2)
  23.         if sec == nil then
  24.                 while true do
  25.                         local event, but, x, y = os.pullEvent("mouse_click")
  26.                                 if event == "mouse_click" then
  27.                                         return x, y, but
  28.                                 end
  29.                 break
  30.                 end
  31.         elseif sec == true then
  32.                 local _, but, x, y = os.pullEvent("mouse_click")
  33.                 if x >= x1 and x <= x2 and y >= y1 and y <= y2 then
  34.                         return true
  35.                 end
  36.         end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement