Advertisement
Guest User

startup

a guest
Mar 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.85 KB | None | 0 0
  1. backc = 32768
  2. background = paintutils.loadImage("sys/back.png")
  3. openbil = paintutils.loadImage("sys/open.png")
  4. terbil = paintutils.loadImage("sys/ter.png")
  5. back = ""
  6. function dd ()
  7. term.setBackgroundColor(backc)
  8. term.clear()
  9. paintutils.drawImage(background, 1, 1)
  10.  
  11. tx = 4 ty = 18
  12. text = "Open File|"
  13. term.setCursorPos(5,18)
  14. print(text)
  15.  
  16. tx3 = 18 ty3 = 18
  17. text3 = "Execute"
  18. term.setCursorPos(tx3, ty3)
  19. print(text3)
  20.  
  21. tx1 = 15 ty1 = 18
  22. text1 = "DD:"
  23. term.setCursorPos(tx1,ty1)
  24. print(text1)
  25.  
  26. tx2 = 1 ty2 = 18
  27. text2 = "I/O|"
  28. term.setCursorPos(tx2, ty2)
  29. print(text2)
  30.  
  31. icox = 5 icoy = 3
  32. paintutils.drawImage(terbil, icox, icoy)
  33. term.setCursorPos(icox +1 , icoy +1)
  34. print("C: >")
  35.  
  36. end
  37. opf = false
  38. dd()
  39.  
  40. function openfile (x, y)
  41. term.setCursorPos(x, y)
  42. back = read()
  43. if back ~= "" then
  44. shell.openTab("edit ", back)
  45. end
  46. end
  47. function openimage(x,y)
  48. term.setCursorPos(x, y)
  49. back = read()
  50. if back ~= "" then
  51. shell.openTab("paint ", back)
  52. end
  53. end
  54. function execut(x,y)
  55. term.setCursorPos(x, y)
  56. back = read()
  57. if back ~= "" then
  58. shell.openTab(back)
  59. end
  60. end
  61.  
  62. while true do
  63. e, but, cx, cy = os.pullEvent()
  64. if e == "mouse_click" then
  65.     if cx >= tx+1 and cx <= tx+text:len()-1 and cy == ty then
  66.        paintutils.drawImage(openbil, 10, 9)
  67.        term.setBackgroundColor(128)
  68.        term.setCursorPos(10,9)
  69.        print("Open File")
  70.        term.setBackgroundColor(16384)
  71.        term.setCursorPos(31, 9)      
  72.        print("X")
  73.        opf = true
  74.        term.setBackgroundColor(128)
  75.        openfile(13, 12)
  76.        term.setBackgroundColor(backc)
  77.      elseif cx >= tx1 and cx <= tx1+text1:len()-2 and cy == ty1 then
  78.        paintutils.drawImage(openbil, 10,9)
  79.        term.setBackgroundColor(128)
  80.        term.setCursorPos(10,9)
  81.        print("Open Image")
  82.        term.setBackgroundColor(16384)
  83.        term.setCursorPos(31, 9)
  84.        print("X")
  85.        opf = true
  86.        term.setBackgroundColor(128)
  87.        openimage(13, 12)
  88.        term.setBackgroundColor(backc)
  89.      elseif cx >=tx3 and cx <=tx3+text3:len()-1 and cy == ty3 then
  90.       paintutils.drawImage(openbil, 10,9)
  91.       term.setBackgroundColor(128)
  92.       term.setCursorPos(10, 9)
  93.       print("Execute (.exe)")
  94.       term.setBackgroundColor(16384)
  95.       term.setCursorPos(31,9)
  96.       print("X")
  97.       opf = true
  98.       term.setBackgroundColor(128)
  99.       execut(13, 12)
  100.       term.setBackgroundColor(backc)
  101.      elseif cx >=tx2 and cx <=tx2+text2:len()-2 and cy == ty2 then
  102.        os.shutdown()
  103.      elseif cx >= icox and cx <= icox+5 and cy >= icoy and cy <= icoy+5 then
  104.         term.setBackgroundColor(32768)
  105.         term.setCursorPos(1,1)
  106.         term.setTextColor(1)
  107.         term.clear()
  108.         return
  109.      elseif cx >= 31 and cx <= 31+1 and cy == 9 then
  110.        if opf == true then
  111.          
  112.          dd()
  113.          
  114.          opf = false
  115.      end
  116.     end  
  117.    end
  118. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement