Advertisement
DOGGYWOOF

noeesdasd

Jan 21st, 2024 (edited)
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. -- Desktop program for ComputerCraft in Minecraft
  2.  
  3. local term = term
  4. local shell = shell
  5. local colors = colors
  6.  
  7. -- Function to draw the desktop
  8. local function drawDesktop()
  9. term.setBackgroundColor(colors.blue)
  10. term.clear()
  11.  
  12. -- Draw the taskbar at the bottom
  13. term.setCursorPos(1, 5)
  14. term.setBackgroundColor(colors.green)
  15. term.setTextColor(colors.white)
  16. term.write(" Start ")
  17.  
  18. term.setCursorPos(1, 1)
  19. term.setBackgroundColor(colors.blue)
  20. term.write(" ")
  21. end
  22.  
  23. -- Function to draw the start menu
  24. local function drawStartMenu()
  25. term.setBackgroundColor(colors.black)
  26. term.clear()
  27. print("Start Menu:")
  28. print("1. Programs")
  29. print("2. Command")
  30. print("3. Shutdown")
  31. print("4. Sign Out")
  32. print("Press any key to return to desktop.")
  33. end
  34.  
  35. -- Main loop
  36. while true do
  37. drawDesktop()
  38.  
  39. -- Handle mouse click
  40. local event, button, x, y = os.pullEvent("mouse_click")
  41.  
  42. -- Check if the click is within the Start button
  43. if x == 1 and y == 5 then
  44. drawStartMenu()
  45. os.pullEvent("key")
  46. end
  47. end
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement