Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w,h = term.getSize()
- --Center Text
- function printCentered (y,s)
- local x = math.floor((w - string.len(s)) /2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write(s)
- end
- --Drawmenu
- local nOption = 1
- local function drawMenu()
- term.setBackgroundColor(colors.cyan)
- term.clear()
- term.setCursorPos(1,1)
- local logo = paintutils.loadImage("os/.logo")
- paintutils.drawImage(logo, 1, 1)
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(w-11,1)
- if nOption == 1 then
- term.write("YES")
- elseif nOption == 2 then
- term.write("NO")
- elseif nOption == 3 then
- term.write("EXIT SETUP")
- else
- end
- end
- --GUI
- term.clear()
- local function drawFrontend()
- printCentered(math.floor(h/2) -3, "")
- printCentered(math.floor(h/2) -2, "INSTALL USING FLOPPY DISK?")
- printCentered(math.floor(h/2) -1, "")
- printCentered(math.floor(h/2) + 0, (nOption == 1 and "[ YES ]") or "YES")
- printCentered(math.floor(h/2) + 1, (nOption == 2 and "[ NO ]") or "NO")
- printCentered(math.floor(h/2) + 2, (nOption == 3 and "[ EXIT SETUP ]") or "EXIT SETUP")
- end
- --Display
- drawMenu()
- drawFrontend()
- while true do
- local e,p = os.pullEvent()
- if e == "key" then
- local key = p
- if key == 17 or key == 200 then
- if nOption > 1 then
- nOption = nOption -1
- drawMenu()
- drawFrontend()
- end
- elseif key == 31 or key == 208 then
- if nOption < 3 then
- nOption = nOption +1
- drawMenu()
- drawFrontend()
- end
- elseif key == 28 then
- break
- end
- end
- end
- term.clear()
- --Conditions
- if nOption == 1 then
- shell.run("rm disk/*")
- shell.run("pastebin get n5e0HdMR disk/startup")
- shell.run("pastebin get GQyFnaPu disk/installer")
- shell.run("pastebin get pbLcNfKv disk/install")
- shell.run("disk/install")
- elseif nOption == 2 then
- shell.run("pastebin get G7Teq7mR startup")
- shell.run("pastebin get GQyFnaPu os/install")
- shell.run("pastebin get fAUEnic0 os/installer")
- os.reboot()
- shell.run("os/installer")
- else
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- end
Add Comment
Please, Sign In to add comment