Z1maV1

linc

May 8th, 2024
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. function drawTopBar(name)
  2. local title = "LINC " .. name
  3.  
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. w, h = term.getSize()
  7.  
  8. term.setBackgroundColor(colors.lightGray)
  9. term.setTextColor(colors.black)
  10.  
  11. term.clearLine()
  12.  
  13. term.setCursorPos(math.floor((w - #title)/2), 1)
  14.  
  15. print(title)
  16.  
  17. term.setBackgroundColor(colors.black)
  18. term.setTextColor(colors.white)
  19. end
  20.  
  21. function drawButton(str, bgcolor, fgcolor, keycolor)
  22. local bg = term.getBackgroundColor()
  23. local fg = term.getTextColor()
  24. write(" ")
  25. term.setBackgroundColor(bgcolor)
  26. term.setTextColor(fgcolor)
  27. term.write("[ ")
  28.  
  29. term.setTextColor(keycolor)
  30. term.write(str:sub(1,1))
  31. term.setTextColor(fgcolor)
  32. term.write(str:sub(2, #str) .. " ]")
  33. term.setBackgroundColor(bg)
  34. term.setTextColor(fg)
  35. write(" ")
  36. end
  37.  
  38. return { drawTopBar = drawTopBar, drawButton = drawButton }
Advertisement
Add Comment
Please, Sign In to add comment