Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to draw navigation bar
- function drawNavBar()
- local screenWidth, screenHeight = term.getSize()
- local navBarWidth = 20
- local navBarStart = math.floor((screenWidth - navBarWidth) / 2)
- -- Save current cursor position
- local oldX, oldY = term.getCursorPos()
- -- Draw Recents button
- term.setCursorPos(navBarStart + 4, screenHeight)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write(" lll ")
- -- Draw Home button
- term.setCursorPos(navBarStart + 9, screenHeight)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write(" () ")
- -- Draw Back button
- term.setCursorPos(navBarStart + 14, screenHeight)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write(" < ")
- -- Restore cursor position
- term.setCursorPos(oldX, oldY)
- end
- --Alternative shell from CraftOS shell
- termutils = {}
- termutils.clear = function()
- term.clear()
- term.setCursorPos(1,1)
- end
- termutils.clearColor = function()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- function input()
- termutils.clearColor()
- drawNavBar() -- Draw the navigation bar
- term.setTextColor(colors.blue)
- local dir = shell.dir().."/"..">"
- write(dir)
- termutils.clearColor()
- command = io.read()
- -- Detect mouse click events
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if yPos == term.getHeight() then
- if xPos >= navBarStart + 4 and xPos <= navBarStart + 6 then
- -- Execute recents command
- shell.run("/disk/os/recents")
- elseif xPos >= navBarStart + 9 and xPos <= navBarStart + 11 then
- -- Execute home command
- shell.run("/disk/os/gui")
- end
- end
- end
- termutils.clear()
- print("Dogdroid Admin Shell V12.0")
- while true do
- input()
- shell.run(command)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement