Advertisement
ecoMeco

AdmiOS - DESKTOP - TRPATCH

Jun 20th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.77 KB | None | 0 0
  1. ------------------------------------
  2. --AdmiOS-----Desktop----Raw---CODE--
  3. ------------------------------------
  4. --Proceed with caution
  5. -- (CHANGES TAKE EFFECT AFTER AN RESTART)
  6.  
  7. a = 0
  8. renderTime = true
  9. time = tostring(textutils.formatTime(os.time(), false))
  10. desktopDrawn=0
  11. slc = 0
  12. tBarC = 8
  13. tBartC = 1
  14. backColor = colors.black
  15. term.setBackgroundColor(backColor)
  16. term.clear()
  17. ContextX = 0
  18. ContextY = 0
  19.  
  20. function DisplayTime()
  21. local nTime = os.time()
  22. print (textutils.formatTime(nTime, false))
  23. TimeDisplay = os.startTimer(1)
  24. end
  25.  
  26. function titleBar()
  27.   term.setCursorPos(1,1)
  28.   term.setBackgroundColor(tBarC)
  29.   term.setTextColor(tBartC)
  30.   term.clearLine()
  31.   term.setCursorPos(1, 1)
  32.   term.setBackgroundColor(colors.green)
  33.   print("Baslat")
  34.   term.setCursorPos(45,1)
  35.   term.setBackgroundColor(tBarC)
  36.   DisplayTime()
  37. end
  38. function drawDesktop()
  39.   term.setBackgroundColor(backColor)
  40.   term.clear()
  41.   bground = paintutils.loadImage("pics/desktop_bg")
  42.   paintutils.drawImage(bground,1,1)
  43.   titleBar()
  44. end
  45. function drawMenu1()
  46. term.setTextColor(256)
  47. term.setBackgroundColor(colors.blue)
  48. term.setCursorPos(1,2)
  49. print("              ")
  50. term.setCursorPos(1,3)
  51. sleep(.1)
  52. print("Kapat         ")
  53. term.setCursorPos(1,4)
  54. sleep(.1)
  55. print("Yeniden baslat")
  56. term.setCursorPos(1,5)
  57. sleep(.1)
  58. print("Kod duzenle   ")
  59. term.setCursorPos(1,6)
  60. sleep(.1)
  61. print("Programlar  > ")
  62. term.setCursorPos(1,7)
  63. sleep(.1)
  64. print("Konsol        ")
  65. term.setCursorPos(1,8)
  66. sleep(.1)
  67. print("              ")
  68. end
  69.  
  70. function drawMenu2()
  71. term.setTextColor(256)
  72. term.setBackgroundColor(colors.blue)
  73. term.setCursorPos(14,6)
  74. print("             ")
  75. term.setCursorPos(14,7)
  76. sleep(.1)
  77. print("Dosyalar     ")
  78. term.setCursorPos(14,8)
  79. sleep(.1)
  80. print("Internet     ")
  81. term.setCursorPos(14,9)
  82. sleep(.1)
  83. print("Boyama       ")
  84. term.setCursorPos(14,10)
  85. sleep(.1)
  86. print("Kod duzenleme")
  87. term.setCursorPos(14,11)
  88. sleep(.1)
  89. print("             ")
  90. end
  91.  
  92. drawDesktop()
  93. while true do
  94. local event, button, X, Y = os.pullEventRaw()
  95.   if slc == 0 then
  96.     if event == "mouse_click" then
  97.       if X >=1 and X <=6 and Y==1 and button ==1 then
  98.       drawMenu1()
  99.       slc = 1
  100.       else
  101.         drawDesktop()
  102.         end
  103.         end
  104.    elseif slc == 1 then
  105.      if X >=1 and X <=14 and button == 1 and Y== 3 then slc = 0
  106.        shell.run("goodbye -s")
  107.        elseif X>=1 and X<=14 and Y==4 and button ==1 then slc = 0
  108.        shell.run("goodbye -r")
  109.        elseif X>=1 and X<=14 and Y==5 and button ==1 then slc = 0
  110.        shell.run("luaide desktop")
  111.        drawDesktop()  
  112.        elseif X>=1 and X<=14 and Y==6 and button ==1 then slc = 0
  113.         slc = 2
  114.         drawMenu2()
  115.        elseif X>=1 and X<=14 and Y==7 and button ==1 then slc = 0
  116.         shell.run("terminal_starter")
  117.        else
  118.        slc = 0
  119.        drawDesktop()
  120.        end    
  121.     elseif slc == 2 then
  122.      if X >=10 and X <=20 and button == 1 and Y==7 then slc = 0
  123.      shell.run("fman")
  124.      drawDesktop()  
  125.      elseif X>=10 and X <=20 and button==1 and Y==8 then slc = 0
  126.      shell.run("firewolf")
  127.      drawDesktop()
  128.      elseif X>=10 and X <=20 and button==1 and Y==9 then slc = 0
  129.      shell.run("sketch")
  130.      drawDesktop()
  131.      elseif X>=10 and X <=20 and button==1 and Y==10 then slc = 0
  132.      shell.run("luaide")
  133.      else
  134.      slc = 0
  135.      drawDesktop()
  136.  
  137.      end
  138.      elseif slc == 3 then
  139.       if X >= ContextX and X <= ContextX+13 and Y == ContextY+2 and button == 1 then
  140.       term.clear()
  141.       term.setCursorPos(1,1)
  142.       os.run({}, "rom/programs/shell")
  143. end
  144. end
  145. end
  146.  
  147. function DisplayTime()
  148. local x, y = term.getCursorPos()
  149. local nTime = os.time()
  150. term.clear()
  151. term.setCursorPos(1, 45)
  152. print (textutils.formatTime(nTime, bTwentyFourHour))
  153. TimeDisplay = os.startTimer(1)
  154. term.setCursorPos(x,y)
  155. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement