Advertisement
Guest User

startup

a guest
Oct 14th, 2013
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | None | 0 0
  1. -- ####### move window #######
  2. function test()
  3.  while true do
  4.    local event, button, X, Y = os.pullEvent("mouse_drag") -- mouse drag function
  5.    XY = X..","..Y
  6.     if button == 1 then -- window design
  7.       term.setBackgroundColor(8)
  8.       shell.run("clear")
  9.       term.setBackgroundColor(8)
  10.       term.setCursorPos(X-8,Y)
  11.       term.setBackgroundColor(2048)
  12.       write("Test.exe        ")
  13.       term.setBackgroundColor(1)
  14.       term.setBackgroundColor(16384)
  15.       write("X") -- close (does not work)
  16.       term.setBackgroundColor(256)
  17.       term.setCursorPos(X-8,Y+1)
  18.       print("                 ")
  19.       term.setCursorPos(X-8,Y+2)
  20.       print("     Hello       ")
  21.       term.setCursorPos(X-8,Y+3)
  22.       print("                 ")
  23.       term.setCursorPos(X-8,Y+4)
  24.       print("                %")
  25.       term.setBackgroundColor(8)
  26.     end
  27.   end
  28.  end
  29.  
  30.  
  31. -- ####### dekstop icon #######
  32. term.setBackgroundColor(8)
  33. shell.run("clear")
  34. term.setCursorPos(5,3)
  35. term.setBackgroundColor(16384)
  36. write(" ")
  37. term.setBackgroundColor(16)
  38. write(" ")
  39. term.setBackgroundColor(16384)
  40. write(" ")
  41. term.setCursorPos(5,4)
  42. term.setBackgroundColor(2048)
  43. write(" ")
  44. term.setBackgroundColor(1)
  45. write(" ")
  46. term.setBackgroundColor(2048)
  47. write(" ")
  48. term.setCursorPos(3,5)
  49. term.setBackgroundColor(8)
  50. write("Test.exe")
  51.  
  52. -- ####### open window #######
  53. while true do
  54. local event, btn, mouseX, mouseY = os.pullEvent("mouse_click") -- mouse click function
  55. if mouseX >= 5 and mouseX <= 7 and mouseY == 3 or mouseX >= 5 and mouseX <= 7 and mouseY == 4  or mouseX >= 3 and mouseX <= 9 and mouseY == 5 then -- icon area
  56. B = 6
  57. A = 15
  58.       term.setBackgroundColor(8) -- window design
  59.       shell.run("clear")
  60.       term.setBackgroundColor(8)
  61.       term.setCursorPos(A,B)
  62.       term.setBackgroundColor(2048)
  63.       write("Text.exe        ")
  64.       term.setBackgroundColor(1)
  65.       term.setBackgroundColor(16384)
  66.       write("X")
  67.       term.setBackgroundColor(256)
  68.       term.setCursorPos(A,B+1)
  69.       print("                 ")
  70.       term.setCursorPos(A,B+2)
  71.       print("     Hello       ")
  72.       term.setCursorPos(A,B+3)
  73.       print("                 ")
  74.       term.setCursorPos(A,B+4)
  75.       print("                %")
  76. test()
  77. break
  78. end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement