Advertisement
dragonfreak1000

Browser

Dec 21st, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. function mouseCheck()
  2.     while true do
  3.         local event, button, xPos, yPos = os.pullEvent("mouse_click")
  4.         if (yPos == y and xPos < 6) then
  5.             if startMenu then
  6.                 drawDefault()
  7.                 startMenu = false
  8.             else
  9.                 drawStart()
  10.                 startMenu = true
  11.             end
  12.         elseif yPos == 8 and xPos > 13 and xPos < 18 and startMenu then
  13.             os.shutdown()
  14.         elseif yPos == 10 and xPos > 1 and xPos < 18 and startMenu then
  15.             shell.run("/DragonOS/Core/LegacyBrowser")
  16.         elseif yPos == 12 and xPos > 1 and xPos < 18 and startMenu then
  17.             shell.run("/DragonOS/DragonUpdate")
  18.         elseif yPos == 14 and xPos > 1 and xPos < 18 and startMenu then
  19.             shell.run("/DragonOS/Core/change")
  20.         elseif yPos == 16 and xPos > 1 and xPos < 18 and startMenu then
  21.             shell.run("cd","/")
  22.             term.setBackgroundColor(colors.black)
  23.             shell.run("clear")
  24.             error()
  25.         end
  26.     end
  27. end
  28.  
  29. function drawTime()
  30.     while true do
  31.         coroutine.resume(mouseevnt)
  32.         term.setBackgroundColor(colors.blue)
  33.         term.setCursorPos(x-7,y)
  34.         term.write(textutils.formatTime(os.time(), false))
  35.                 term.setCursorPos(x,y)
  36.         sleep(0.1)
  37.     end
  38. end
  39.  
  40. function drawDefault()
  41.     paintutils.drawImage(screen,1,1)
  42.     term.setBackgroundColor(colors.lime)
  43.     term.setCursorPos(1,y)
  44.     term.write("Start")
  45.     term.setCursorPos(x,y)
  46. end
  47.  
  48. function drawStart()
  49.   paintutils.drawImage(start,1,1)
  50.   term.setBackgroundColor(colors.cyan)
  51.   term.setCursorPos(14,8)
  52.   term.write("Off")
  53.   term.setBackgroundColor(colors.orange)
  54.   term.setCursorPos(2,10)
  55.   term.write("Terminal >")
  56.   term.setCursorPos(2,12)
  57.   term.write("Update >")
  58.   term.setCursorPos(2,14)
  59.   term.write("Set usr/pass >")
  60.   term.setCursorPos(2,16)
  61.   term.write("CraftOS >")
  62.   term.setCursorPos(x,y)
  63. end
  64.  
  65. screen = paintutils.loadImage("/DragonOS/Core/Screen")
  66. start = paintutils.loadImage("/DragonOS/Core/Start")
  67. x,y = term.getSize()
  68. startMenu = false
  69. drawDefault()
  70. mouseevnt = coroutine.create(mouseCheck())
  71. drawTime()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement