ThyMason122

MasonOS

Dec 23rd, 2015
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Varibles
  2.   version = 1.4
  3.   running = true
  4.  
  5.  
  6.   --Images
  7.   bg1 = paintutils.loadImage("bg1")
  8.   bg2 = paintutils.loadImage("bg2")
  9.   bg3 = paintutils.loadImage("bg3")
  10.   bg4 = paintutils.loadImage("bg4") --Background by SargentsteveEr
  11.   _plate = paintutils.loadImage("plate")
  12.   _mtab = paintutils.loadImage("mtab")
  13.   rscon = paintutils.loadImage("rscon")
  14.  
  15.   _ms = 0
  16.   b2 = 1
  17.    
  18. --Functions
  19.   clear = function()
  20.     term.setBackgroundColor(colors.black)
  21.     term.clear()
  22.     term.setCursorPos(1, 1)
  23.   end
  24.  
  25.   drawMenu1 = function()
  26.     term.setCursorPos(1, 18)
  27.     term.setBackgroundColor( colors.lime )
  28.     term.setTextColor( colors.white )
  29.     print("Power   ")
  30.     term.setCursorPos(1, 17)
  31.     print("BgPick  ")
  32.     term.setCursorPos(1, 16)
  33.     print("Programs")
  34.   end
  35.  
  36.   Naminginput = function()
  37.     term.setBackgroundColor(colors.lightGray)
  38.     term.setTextColor(colors.black)
  39.     paintutils.drawImage(_plate, 1,1)
  40.     term.setCursorPos(18, 8)
  41.     write("Open the file")
  42.     term.setCursorPos(18, 9)
  43.     naminginput = read()
  44.     shell.run("paint", naminginput)
  45.     init()
  46.   end
  47.  
  48.  
  49.  
  50.   bgtab = function()
  51.     term.setBackgroundColor(colors.lightGray)
  52.     term.setTextColor(colors.black)
  53.     paintutils.drawImage(_plate, 1,1)
  54.     term.setCursorPos(18, 8)
  55.     write("Pick Your BG")
  56.     term.setCursorPos(20, 10)
  57.     term.setBackgroundColor(colors.white)
  58.     write("-")
  59.     term.setCursorPos(26, 10)
  60.     write("+")
  61.   end
  62.  
  63.   mtab = function()
  64.     term.setBackgroundColor(colors.lightGray)
  65.     paintutils.drawImage(_mtab, 1,1)
  66.     term.setCursorPos(34, 4)
  67.     term.setTextColor(colors.blue)
  68.     write("Programs:")
  69.     term.setCursorPos(34, 5)
  70.     term.setTextColor(colors.black)
  71.     write("CC Paint")
  72.     term.setCursorPos(34, 6)
  73.     write("Redset")
  74.   end
  75.  
  76.   rscontrol = function()
  77.     term.setBackgroundColor(colors.lightGray)
  78.     paintutils.drawImage(rscon, 1,1)
  79.     _rs = 1
  80.   end
  81.      
  82.  
  83.   drawTaskBar = function()
  84.     term.setCursorPos(1, 19)
  85.     term.setBackgroundColor( colors.lightBlue )
  86.     term.clearLine()
  87.     term.setCursorPos(1, 19)
  88.     term.setBackgroundColor( colors.lime )
  89.     term.setTextColor( colors.white )
  90.     term.write("Menu  ")
  91.     sleep()
  92.     term.setCursorPos(46, 19)
  93.   end
  94.  
  95.   drawDeskTop = function()
  96.     term.setBackgroundColor(colors.white)
  97.     term.clear()
  98.     term.setCursorPos(1, 1)
  99.     if b2 == 1 then
  100.       paintutils.drawImage(bg1, 1,1)
  101.     elseif b2 == 2 then
  102.       paintutils.drawImage(bg2, 1,1)
  103.     elseif b2 == 3 then
  104.       paintutils.drawImage(bg3, 1,1)
  105.     elseif b2 == 4 then
  106.       paintutils.drawImage(bg4, 1,1)
  107.     end
  108.   end
  109.  
  110.  
  111.   stop = function()
  112.     clear()
  113.     running = false
  114.     term.setTextColor( colors.orange )
  115.     os.shutdown()
  116.   end  
  117.  
  118.   runTime = function()
  119.     while running do
  120.       event, button, x, y = os.pullEvent("mouse_click")
  121.       if _ms == 0 and button == 1 and x < 9 and y == 19 then
  122.         drawMenu1()
  123.         _ms = 1
  124.       elseif _ms == 1 and button == 1 and y == 18 and x < 7 then
  125.         stop()
  126.       elseif _ms == 1 and button == 1 and x < 9 and y == 19 then
  127.         init()
  128.       elseif _ms == 1 and button == 1 and x < 9 and y == 17 then
  129.         bgtab()
  130.       elseif _ms == 1 and button == 1 and x == 31 and y == 5 then
  131.         init()
  132.       elseif _ms == 1 and b2 > 1 and button == 1 and x == 20 and y == 10 then
  133.         b2 = b2 - 1
  134.         init()
  135.       elseif _ms == 1 and b2 < 4 and button == 1 and x == 26 and y == 10 then
  136.         b2 = b2 + 1
  137.         init()
  138.       elseif _ms == 1 and button == 1 and x < 9 and y == 16 then
  139.         mtab()
  140.       elseif _ms == 1 and button == 1 and x == 47 and y == 2 then
  141.         init()
  142.       elseif _ms == 1 and button == 1 and x == 45 and y == 5 then
  143.         Naminginput()
  144.       elseif _ms == 1 and button == 1 and x == 45 and y == 6 then
  145.         rscontrol()
  146.       elseif _rs == 1 and button == 1 and x == 14 and y == 2 then
  147.         _rs = 0
  148.         init()
  149.       elseif _rs == 1 and button == 1 and x == 6 and y == 4 then
  150.         rs.setOutput("back", true)
  151.         sleep(1)
  152.       elseif _rs == 1 and button == 1 and x == 5 and y == 5 then
  153.         rs.setOutput("left", true)
  154.         sleep(1)
  155.       elseif _rs == 1 and button == 1 and x == 7 and y == 5 then
  156.         rs.setOutput("right", true)
  157.         sleep(1)
  158.       elseif _rs == 1 and button == 1 and x == 6 and y == 6 then
  159.         rs.setOutput("front", true)
  160.         sleep(1)
  161.       elseif _rs == 1 and button == 1 and x == 12 and y == 4 then
  162.         rs.setOutput("back", false)
  163.         sleep(1)
  164.       elseif _rs == 1 and button == 1 and x == 11 and y == 5 then
  165.         rs.setOutput("left", false)
  166.         sleep(1)
  167.       elseif _rs == 1 and button == 1 and x == 13 and y == 5 then
  168.         rs.setOutput("right", false)
  169.         sleep(1)
  170.       elseif _rs == 1 and button == 1 and x == 12 and y == 6 then
  171.         rs.setOutput("front", false)
  172.       end
  173.     end
  174.   end
  175.    
  176.   init = function()
  177.     _ms = 0
  178.     drawDeskTop()
  179.     drawTaskBar()
  180.     runTime()
  181.  end
  182.  
  183. init()
Add Comment
Please, Sign In to add comment