Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("DZSystem/API/Color")
- --os.pullEvent = os.pullEventRaw
- local XSize, YSize = term.getSize()
- local ID = os.computerID()
- local Selector = 1
- local Menu = {"First","Second","Third","Exit"}
- local function clearScreen(color)
- term.setBackgroundColor(color)
- term.clear()
- end
- local function fadeIn(time)
- clearScreen(Color.Gray)
- sleep(time)
- clearScreen(Color.LGray)
- sleep(time)
- clearScreen(Color.Blue)
- sleep(time)
- term.setCursorPos(1,1)
- end
- local function fadeOut(time)
- clearScreen(Color.LGray)
- sleep(time)
- clearScreen(Color.Black)
- sleep(time)
- term.setCursorPos(1,1)
- term.setTextColor(Color.White)
- end
- local function horisontalBar(x,y,width,color)
- for i=x,(x+width-1) do
- paintutils.drawPixel(i,y,color)
- end
- end
- local function centerText(how,coord,text,textColor)
- term.setTextColor(textColor)
- if how == "xy" then
- term.setCursorPos(math.floor(XSize/2-#text/2),math.floor(YSize/2))
- elseif how == "x" then
- term.setCursorPos(math.floor(XSize/2-#text/2),coord)
- elseif ohw == "y" then
- term.setCursorPos(coord,math.floor(XSize/2))
- end
- term.write(text)
- end
- local function gui()
- for i=1,4 do
- if i == Selector then
- term.setTextColor(Color.Red)
- write(">")
- end
- term.setTextColor(Color.White)
- print(Menu[i])
- end
- end
- fadeIn(0)
- term.setTextColor(Color.Yellow)
- print("ID: "..ID)
- sleep(3)
- gui()
- while true do
- local scancode = os.pullEvent("key")
- if scancode == 200 then
- Selector = Selector-1
- if Selector<1 then Selector = 1 end
- gui()
- elseif scancode == 208 then
- Selector = Selector+1
- if Selector>4 then Selector=4 end
- gui()
- elseif scancode == 28 and Selector == 4 then
- break
- end
- end
- fadeOut(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement