Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Desktop program for ComputerCraft in Minecraft
- local term = term
- local shell = shell
- local colors = colors
- -- Function to draw the desktop
- local function drawDesktop()
- term.setBackgroundColor(colors.blue)
- term.clear()
- -- Draw the taskbar at the bottom
- term.setCursorPos(1, 5)
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- term.write(" Start ")
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.blue)
- term.write(" ")
- end
- -- Function to draw the start menu
- local function drawStartMenu()
- term.setBackgroundColor(colors.black)
- term.clear()
- print("Start Menu:")
- print("1. Programs")
- print("2. Command")
- print("3. Shutdown")
- print("4. Sign Out")
- print("Press any key to return to desktop.")
- end
- -- Main loop
- while true do
- drawDesktop()
- -- Handle mouse click
- local event, button, x, y = os.pullEvent("mouse_click")
- -- Check if the click is within the Start button
- if x == 1 and y == 5 then
- drawStartMenu()
- os.pullEvent("key")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement