Advertisement
tima_gt

tde-desktop 1.1 [OpenComputers]

Apr 12th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.85 KB | None | 0 0
  1. local shell = require("shell")
  2. local function terminal()
  3. local component = require("component")
  4. local xorg = component.gpu
  5. local term = require("term")
  6. local shell = require("shell")
  7. local colors = require("colors")
  8. local w, h = xorg.getResolution()
  9. xorg.setBackground(0xeeeFFF)
  10. xorg.setForeground(0xFFFFFF)
  11. xorg.fill(1, 1, w, h, " ")
  12. term.setCursor(1, 1)
  13. print("tde terminal emulator")
  14. while true do
  15. xorg.setForeground(0xFFFFFFe)
  16. io.write("> ")
  17. xorg.setForeground(0xFFFFFF)
  18. cmd = io.read()
  19. if cmd == "exit" then
  20. break
  21. else
  22. shell.execute(cmd)
  23. end
  24. end
  25. end
  26. local function menu()
  27. terminal_icon_1 = {
  28.        "            ",
  29.        "            ",
  30.        "            ",
  31.        " >_         ",
  32.        "            "
  33. }
  34. local component = require("component")
  35. local xorg = component.gpu
  36. local colors = require("colors")
  37. local term = require("term")
  38. local w, h = xorg.getResolution()
  39. local event = require("event")
  40. xorg.setBackground(0x000000)
  41. xorg.setForeground(0xFFFFFF)
  42. xorg.fill(1, 1, w, h, " ")
  43. term.setCursor(1, 1)
  44. io.write("[<--] back")
  45. term.setCursor(3, 4)
  46. xorg.setBackground(0xeeeFFF)
  47. i = 1
  48. while i <= 4 do
  49. term.setCursor(3, 3 + i)
  50. if i == 3 then
  51. io.write(" >_     ")
  52. else
  53. io.write("        ")
  54. end
  55. i = i + 1
  56. end
  57. xorg.setBackground(0x000000)
  58. term.setCursor(2, 10)
  59. io.write("Terminal")
  60. xorg.setBackground(0xFF0000)
  61. i = 1
  62. while i <= 4 do
  63. term.setCursor(13, 3 + i)
  64. io.write("        ")
  65. i = i + 1
  66. end
  67. xorg.setBackground(0x000000)
  68. term.setCursor(13, 10)
  69. io.write("Redstone")
  70. local event, adress, arg1, arg2, arg3 = event.pull()
  71. if event == "touch" then
  72. X = arg1
  73. Y = arg2
  74. if X >= 2 and X <= 10 and Y >= 4 and Y <= 10 then
  75. terminal()  
  76. elseif X >= 13 and X <= 13 + 8 and Y >= 4 and Y <= 10 then
  77. local shell = require("shell")
  78. shell.execute("tde-redstone")
  79. end
  80. end
  81. end
  82. local component = require("component")
  83. local colors = require("colors")
  84. local xorg = component.gpu
  85. local w, h = xorg.getResolution()
  86. local term = require("term")
  87. local event = require("event")
  88. while true do
  89. xorg.setBackground(0xFFFFFF)
  90. xorg.setForeground(0x000000)
  91. xorg.fill(1, 1, w, h, " ")
  92. xorg.setBackground(0x000000)
  93. xorg.setForeground(0xFFFFFF)
  94. xorg.fill(1, 1, w, 1, " ")
  95. term.setCursor(3, 1)
  96. io.write("[Menu]")
  97. term.setCursor(3, h - 1)
  98. io.write("[exit]")
  99. xorg.setBackground(0xCCFFF)
  100. xorg.setForeground(0xFFFFFF)
  101. xorg.fill(w/2, 2, w, h - 2, " ")
  102. term.setCursor(w/2 + 3, 2 + 3)
  103. io.write("TDE Desktop OpenComputers Edition")
  104. local event, adress, arg1,arg2, arg3 = event.pull()
  105. if event == "touch" then
  106. X = arg1
  107. Y = arg2
  108. if X >= 3 and X <= 6 and Y == h - 1 then
  109. xorg.setBackground(0x000000)
  110. xorg.setForeground(0xFFFFFF)
  111. term.clear()
  112. xorg.fill(1, 1, w, h, " ")
  113. term.setCursor(1, 1)
  114. print("*** TDE DESKTOP FOR OPENCOMPUTERS ***")
  115. print("         Thanks for using            ")
  116. break
  117. elseif X >= 3 and X <= 8 and Y == 1 then
  118. menu()
  119. end
  120. end
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement