Advertisement
tima_gt

tde-desktop (OpenComputers)

Mar 24th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 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. local event, adress, arg1, arg2, arg3 = event.pull()
  61. if event == "touch" then
  62. X = arg1
  63. Y = arg2
  64. if X >= 2 and X <= 10 and Y >= 4 and Y <= 10 then
  65. terminal()  
  66. end
  67. end
  68. end
  69. local component = require("component")
  70. local colors = require("colors")
  71. local xorg = component.gpu
  72. local w, h = xorg.getResolution()
  73. local term = require("term")
  74. local event = require("event")
  75. while true do
  76. xorg.setBackground(0xFFFFFF)
  77. xorg.setForeground(0x000000)
  78. xorg.fill(1, 1, w, h, " ")
  79. xorg.setBackground(0x000000)
  80. xorg.setForeground(0xFFFFFF)
  81. xorg.fill(1, 1, w, 1, " ")
  82. term.setCursor(3, 1)
  83. io.write("[Menu]")
  84. term.setCursor(3, h - 1)
  85. io.write("[exit]")
  86. xorg.setBackground(0xCCFFF)
  87. xorg.setForeground(0xFFFFFF)
  88. xorg.fill(w/2, 2, w, h - 2, " ")
  89. term.setCursor(w/2 + 3, 2 + 3)
  90. io.write("TDE Desktop OpenComputers Edition")
  91. local event, adress, arg1,arg2, arg3 = event.pull()
  92. if event == "touch" then
  93. X = arg1
  94. Y = arg2
  95. if X >= 3 and X <= 6 and Y == h - 1 then
  96. xorg.setBackground(0x000000)
  97. xorg.setForeground(0xFFFFFF)
  98. term.clear()
  99. xorg.fill(1, 1, w, h, " ")
  100. term.setCursor(1, 1)
  101. print("*** TDE DESKTOP FOR OPENCOMPUTERS ***")
  102. print("         Thanks for using            ")
  103. break
  104. elseif X >= 3 and X <= 8 and Y == 1 then
  105. menu()
  106. end
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement