asteroidsteam

Desktop

Apr 10th, 2016
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. term.setBackgroundColor(colors.white)
  2. term.clear()
  3. term.setCursorPos(1, 5)
  4. term.setBackgroundColor(colors.blue)
  5. term.setTextColor(colors.white)
  6. print("This Desktop supports:")
  7. function ClD()
  8. term.setBackgroundColor(colors.white)
  9. term.clear()
  10. term.setBackgroundColor(colors.blue)
  11. term.clearLine()
  12. term.setCursorPos(1, 1)
  13. end
  14. term.setCursorPos(1, 5)
  15. term.clearLine()
  16. term.setBackgroundColor(colors.blue)
  17. term.setCursorPos(1, 20)
  18. term.clearLine()
  19. term.setCursorPos(1, 20)
  20. local text2 = "J:OS Beta 1.7"
  21. write(text2)
  22. term.setCursorPos(1, 3)
  23. local image3 = paintutils.loadImage("ASSETS/Desktop")
  24. paintutils.drawImage(image3, 6, 4)
  25. -- Draw the text
  26. local tx, ty = 3, 1
  27. local tx2, ty2 = 15, 1
  28. local tx3, ty3 = 27, 1
  29. local tx4, ty4 = 37, 1
  30. local tx5, ty5 = 3, 3
  31. local tx6, ty6 = 13, 3
  32. local tx7, ty7 = 25, 3
  33. local text2 = "[SETTINGS]"
  34. local text = "[CMD LINE]"
  35. local text3 = "[REBOOT]"
  36. local text4 = "[BROWSER]"
  37. local text5 = "[UPDATE]"
  38. local text6 = "[DOWNLOAD]"
  39. local text7 = "[AntiFile]"
  40. term.setBackgroundColor(colors.red)
  41. term.setCursorPos(1,1)
  42. term.clearLine()
  43. term.setCursorPos(1,2)
  44. term.clearLine()
  45. term.setCursorPos(1,3)
  46. term.clearLine()
  47. term.setCursorPos(1,4)
  48. term.clearLine()
  49. term.setBackgroundColor(colors.green)
  50. term.setCursorPos(tx, ty)
  51. write(text)
  52. term.setCursorPos(tx2,ty2)
  53. write(text2)
  54. term.setCursorPos(tx3,ty3)
  55. write(text3)
  56. term.setCursorPos(tx4,ty4)
  57. write(text4)
  58. term.setCursorPos(tx5,ty5)
  59. write(text5)
  60. term.setCursorPos(tx6,ty6)
  61. write(text6)
  62. term.setCursorPos(tx7,ty7)
  63. write(text7)
  64. -- Event loop
  65. while true do
  66. local sides = {"top","bottom","back","front","left","right"}
  67. local disk1 = disk.isPresent(sides[1])
  68. if disk == true then
  69. disk.eject(sides)
  70. end
  71.   local e, but, cx, cy = os.pullEvent()
  72.   if e == "mouse_click" then
  73.         if cx >= tx and cx <= tx + text:len() and cy == ty then
  74. term.setBackgroundColor(colors.black)
  75. shell.run("os/shell")
  76. break
  77. elseif cx >= tx2 and cx <= tx2 + text:len() and cy == ty2 then
  78. dofile("/os/settings")  
  79. break
  80. elseif cx >= tx3 and cx <= tx3 + text:len() and cy == ty3 then
  81. os.reboot()
  82. elseif cx >= tx4 and cx <= tx4 + text:len() and cy == ty4 then
  83. dofile("/os/browser")
  84. break
  85. elseif cx >= tx5 and cx <= tx5 + text:len() and cy == ty5 then
  86. term.clear()
  87. term.setCursorPos(1,1)
  88. shell.run("/sys/update-scr.lua")
  89. os.reboot()
  90. elseif cx >= tx6 and cx <= tx6 + text:len() and cy == ty6 then
  91. dofile("/os/download")
  92. break
  93. elseif cx >= tx7 and cx <= tx7 + text:len() and cy == ty7 then
  94. dofile("/os/antifile")
  95. break
  96. end
  97. end
  98. end
Advertisement
Add Comment
Please, Sign In to add comment