Advertisement
kyubertino

computerCraftOS

May 4th, 2021 (edited)
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. bg = paintutils.loadImage("myOS/icons/bg.nfp")
  2. function drawDesktop()
  3.     term.setBackgroundColor(colors.lightBlue);
  4.     term.clear();
  5.     paintutils.drawImage(bg,1,2)
  6.     term.setCursorPos(1,1)
  7.     term.setBackgroundColor(colors.white)
  8.     term.setTextColor(colors.black)
  9.     print("PC | ")
  10.     paintutils.drawPixel(51,1,colors.red)
  11.     term.setCursorPos(51,1)
  12.     term.setTextColor(colors.white)
  13.     print("X")
  14. end
  15. running = true;
  16. state = false;
  17. while running do
  18.     drawDesktop();
  19.     event, button, x, y = os.pullEvent("mouse_click");
  20.     if event == "mouse_click" then
  21.         if (x == 1 or x == 2 or x == 3) and y == 1 then
  22.             while true do
  23.                 paintutils.drawFilledBox(1,2,4,4,colors.white);
  24.                 term.setCursorPos(1,2);
  25.                 print("reboot");
  26.                 term.setCursorPos(1,3);
  27.                 print("shutdown");
  28.                 term.setCursorPos(1,4);
  29.                 print("To prompt");
  30.                 event,button,x,y = os.pullEvent("mouse_click");
  31.                 if event == "mouse_click" then
  32.                     break;
  33.                 end
  34.                   end
  35.             end
  36.    end
  37. end
  38. term.clear();
  39. term.setCursorPos(1,1);
  40. shell.run("cd myOS")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement