Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables --
- prefPath = "loc/browser/.pref"
- basePath = "loc/browser/"
- -- Just a load of functions! --
- function mouseAny()
- local event, button, x, y = os.pullEvent("mouse_click")
- if button == 1 then
- end
- end
- function notif(text)
- paintutils.drawLine(2,19,50,19,colors.red)
- center(text,19,colors.black)
- end
- function oneEntry()
- outputKey = read()
- end
- function keyPress()
- local event, scancode = os.pullEvent("key")
- local event, scancode = os.pullEvent("key")
- if scancode == 26 then
- local event, scancode = os.pullEvent("key")
- end
- end
- function settScreen()
- term.setBackgroundColor(colors.gray)
- term.clear()
- paintutils.drawLine(2,2,50,2,colors.white)
- center("Local Settings & Preferences",2,colors.black)
- yM = 16
- for y=4, yM do
- paintutils.drawLine(2,y,50,y,colors.white)
- end
- paintutils.drawLine(2,18,50,18,colors.white)
- center("Click here to return",18,colors.black)
- term.setCursorPos(3,5)
- write("Cursor Preference: ")
- paintutils.drawPixel(20,5,colors.lightGray)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if button == 1 and x>=2 and x<=50 and y==18 then
- break
- elseif button == 1 and x==20 and y==5 then
- --local fin = parallel.waitForAny(mouseAny,oneEntry)
- local outputKey = read()
- if outputKey ~= nil then
- local h = fs.open("pref", "w")
- h.writeLine("curPref = \""..outputKey.."\"")
- h.close()
- end
- end
- end
- end
- function aboutScreen()
- --[[
- paintutils.drawLine(2,2,15,2,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(16,2,30,2,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(31,2,45,2,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(46,2,50,2,colors.lightGray)
- paintutils.drawLine(50,2,50,4,colors.lightGray)
- paintutils.drawLine(50,4,45,4,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(44,4,30,4,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(29,4,15,4,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(14,4,2,4,colors.lightGray)
- paintutils.drawPixel(2,3,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(3,3,15,3,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(16,3,30,3,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(31,3,45,3,colors.lightGray)
- sleep(0.1)
- paintutils.drawLine(46,3,50,3,colors.lightGray)
- ]]--
- term.setBackgroundColor(colors.gray)
- term.clear()
- paintutils.drawLine(2,2,50,2,colors.white)
- yM = 16
- for y=4, yM do
- paintutils.drawLine(2,y,50,y,colors.white)
- end
- paintutils.drawLine(2,18,50,18,colors.white)
- center("About the LOC Browser",2,colors.black)
- center("Click here to return",18,colors.black)
- center("The Loc browser was made by Sam Gunner and",4,colors.black)
- center("Cody Robinson. The LOC browser is Copyright (C)",5,colors.black)
- center("2014, Sam Gunner and Cody Robinson.",6,colors.black)
- center("It is designed to work with programs developed",8,colors.black)
- center("specifically with the LOC browser in mind.",9,colors.black)
- center("We have tried to make it as simple as possible",10,colors.black)
- center("to set up and operate web pages with the LOC",11,colors.black)
- center("browser. We hope you enjoy using it.",12,colors.black)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x>=2 and x<=50 and y==18 then
- break
- end
- end
- end
- function mainAct()
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if button == 1 and x>=2 and x<=50 and y>=2 and y<=4 then
- aboutScreen()
- break
- elseif button == 1 and x>=2 and x<=50 and y==18 then
- exComm = true
- break
- elseif button == 1 and x>=2 and x<=50 and y>=6 and y<=8 then
- settScreen()
- break
- end
- end
- end
- function center(text,y,colour)
- local x = ((51-string.len(text))/2)+1
- term.setCursorPos(x,y)
- term.setTextColor(colour)
- print(text)
- end
- function drawMainMenu()
- term.setBackgroundColor(colors.gray)
- term.clear()
- paintutils.drawLine(2,18,50,18,colors.white)
- center("Click here to exit",18,colors.black)
- paintutils.drawLine(2,2,50,2,colors.white) --
- paintutils.drawLine(2,3,50,3,colors.white)
- paintutils.drawLine(2,4,50,4,colors.white)
- paintutils.drawLine(2,6,50,6,colors.white) --
- paintutils.drawLine(2,7,50,7,colors.white)
- paintutils.drawLine(2,8,50,8,colors.white)
- paintutils.drawLine(2,10,50,10,colors.white) --
- paintutils.drawLine(2,11,50,11,colors.white)
- paintutils.drawLine(2,12,50,12,colors.white)
- paintutils.drawLine(2,14,50,14,colors.white) --
- paintutils.drawLine(2,15,50,15,colors.white)
- paintutils.drawLine(2,16,50,16,colors.white)
- center("LOC Browser V1.1",3,colors.black)
- center("Click here to find out more *",4,colors.black)
- center("Local Settings *",7,colors.black)
- center("Favourites",11,colors.black)
- center("Normal Web Browser",15,colors.black)
- end
- function drawStartup()
- local img = paintutils.loadImage("loc/browser/assets/startup.gic")
- paintutils.drawImage(img,1,1)
- sleep(2)
- end
- -- One-off things! --
- --if not settings then os.loadAPI("loc/browser/settings") end
- --if not gAPI then os.loadAPI("loc/browser/gAPI") end
- drawStartup()
- exComm = false
- while true do
- drawMainMenu()
- mainAct()
- if exComm == true then
- break
- end
- end
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.white)
- paintutils.drawLine(1,1,51,1,colors.gray)
- term.setCursorPos(1,1)
- print("Thanks for using the LOC browser!")
- term.setBackgroundColor(colors.black)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement