Advertisement
Guest User

start

a guest
Mar 31st, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 KB | None | 0 0
  1. os.loadAPI("DZSystem/API/Color")
  2. --os.pullEvent = os.pullEventRaw
  3.  
  4. local XSize, YSize = term.getSize()
  5. local ID = os.computerID()
  6. local Selector = 1
  7. local Menu = {"First","Second","Third","Exit"}
  8.  
  9. local function clearScreen(color)
  10.   term.setBackgroundColor(color)
  11.   term.clear()
  12. end
  13.  
  14. local function fadeIn(time)
  15.   clearScreen(Color.Gray)
  16.   sleep(time)
  17.   clearScreen(Color.LGray)
  18.   sleep(time)
  19.   clearScreen(Color.Blue)
  20.   sleep(time)
  21.   term.setCursorPos(1,1)
  22. end
  23.  
  24. local function fadeOut(time)
  25.   clearScreen(Color.LGray)
  26.   sleep(time)
  27.   clearScreen(Color.Black)
  28.   sleep(time)
  29.   term.setCursorPos(1,1)
  30.   term.setTextColor(Color.White)
  31. end
  32.  
  33. local function horisontalBar(x,y,width,color)
  34.   for i=x,(x+width-1) do
  35.     paintutils.drawPixel(i,y,color)
  36.   end
  37. end
  38.  
  39. local function centerText(how,coord,text,textColor)
  40.   term.setTextColor(textColor)
  41.   if how == "xy" then
  42.     term.setCursorPos(math.floor(XSize/2-#text/2),math.floor(YSize/2))
  43.   elseif how == "x" then
  44.     term.setCursorPos(math.floor(XSize/2-#text/2),coord)
  45.   elseif ohw == "y" then
  46.     term.setCursorPos(coord,math.floor(XSize/2))
  47.   end
  48.   term.write(text)
  49. end
  50.  
  51. local function gui()
  52.   for i=1,4 do
  53.     if i == Selector then
  54.       term.setTextColor(Color.Red)
  55.       write(">")
  56.     end
  57.   term.setTextColor(Color.White)
  58.   print(Menu[i])
  59.   end
  60. end
  61.  
  62. fadeIn(0)
  63. term.setTextColor(Color.Yellow)
  64. print("ID: "..ID)
  65. sleep(3)
  66. gui()
  67.  
  68. while true do
  69.   local scancode = os.pullEvent("key")
  70.   if scancode == 200 then
  71.     Selector = Selector-1
  72.     if Selector<1 then Selector = 1 end
  73.     gui()
  74.   elseif scancode == 208 then
  75.     Selector = Selector+1
  76.     if Selector>4 then Selector=4 end
  77.     gui()
  78.   elseif scancode == 28 and Selector == 4 then
  79.     break
  80.   end
  81. end
  82.  
  83. fadeOut(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement