Advertisement
thatparadox

tpTest

May 1st, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. function drawBackground()
  2.   mon.setBackgroundColor(colors.black)
  3.   mon.clear()
  4.   mon.setTextColor(colors.black)
  5.   x,y = mon.getSize()
  6.   for yc = 1,y do
  7.     if yc%2 == 1 then
  8.       mon.setBackgroundColor(colors.purple)
  9.     else
  10.       mon.setBackgroundColor(colors.magenta)
  11.     end
  12.     for xc = 1,x do
  13.       mon.setCursorPos(xc, yc)
  14.       mon.write(" ")
  15.     end
  16.   end
  17. end
  18.  
  19.  
  20. function drawButtons()
  21.   x,y = mon.getSize()
  22.   for i=1,y do
  23.     if fs.exists(tostring(i)) then
  24.       file = fs.open(tostring(i), "r")
  25.       label = file.readAll()
  26.       file.close()
  27.       mon.setCursorPos(x/2 - string.len(label)/2, i)
  28.       if i%2 == 1 then
  29.         mon.setBackgroundColor(colors.purple)
  30.       else
  31.         mon.setBackgroundColor(colors.magenta)
  32.       end
  33.       mon.setTextColor(colors.white)
  34.       mon.write(label)
  35.       mon.setCursorPos(x-2, i)
  36.       mon.setBackgroundColor(colors.black)
  37.       mon.setTextColor(colors.white)
  38.       mon.write(" X ")
  39.     end
  40.   end
  41. end
  42.  
  43. drawBackground()
  44. drawButtons()
  45.  
  46. while true do
  47. os.pullEvent()
  48. rs.setOutput("back", true)
  49. sleep(1)
  50. rs.setOutput("back", false)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement