DMeville

Untitled

Jul 8th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. foundMonitor = false
  2. mw, mh = 0
  3. spawners = {}
  4. spawners[0] = false
  5. spawners[1] = true
  6. red = 16384
  7. green = 32
  8. function drawBox(x,y,w,h,c)
  9.     i, j = 0;
  10.     for i = x, w do
  11.         for j = y, h do
  12.             paintutils.drawPixel(i,j,c)
  13.         end
  14.     end
  15. end
  16. function drawGUI()
  17.     if spawners[0] == true then
  18.         drawBox(mw - mw/2, mh - mh/2, 5,2, green)
  19.     else
  20.         drawBox(mw - mw/2, mh - mh/2, 5,2, red)
  21.     end
  22.     if spawners[1] == true then
  23.         drawBox(mw - mw/2, mh + mh/2, 5,2, green)
  24.     else
  25.         drawBox(mw - mw/2, mh + mh/2, 5,2, red)
  26.     end
  27. end
  28. function update()
  29. print("updating...")
  30. end
  31.  
  32. function init()
  33. if peripheral.isPresent("top") then
  34.     mon = peripheral.wrap("top")
  35.     mw, mh = mon.getSize()
  36.     term.redirect(mon)
  37.     foundMonitor = true
  38. else
  39.     foundMonitor = false
  40.     print("Monitor not found - Aborting")
  41. end
  42. if foundMonitor == true then
  43.     while true do
  44.         mon.clear()
  45.         mon.setCursorPos(1,1)
  46.         update()
  47.         drawGUI()
  48.         sleep(1)
  49.     end
  50. end
  51. end
  52.  
  53. init()
Advertisement
Add Comment
Please, Sign In to add comment