Advertisement
Guest User

CC UI LIBRARY

a guest
Mar 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. ------ VARIABLES ------
  2. l     = "                                                   "
  3. divL  = "___________________________________________________"
  4.  
  5. -- COLORS
  6. c_back  = colors.green
  7. c_text  = colors.white
  8. c_top   = colors.gray
  9. c_error = colors.red
  10. c_info  = colors.cyan
  11.  
  12. cx,cy = term.getCursorPos()
  13. ------ FUNCTIONS -----
  14. function setPos(x,y) term.setCursorPos(x,y) end
  15. function bgCol(c) term.setBackgroundColor(c) end
  16. function fgCol(c) term.setTextColor(c) end
  17. function blink(b) term.setCursorBlink(b) end
  18.  
  19. function tPrint(txt,col)
  20.   fgCol(col)
  21.   print(txt)
  22.   fgCol(c_text)
  23. end
  24.  
  25. function tWrite(txt,col)
  26.   fgCol(col)
  27.   write(txt)
  28.   fgCol(c_text)
  29. end
  30.  
  31. function clear()
  32.   bgCol(c_back)
  33.   term.clear()
  34.   setPos(1,1)
  35. end
  36. function draw_line(count,col,div)
  37.   bgCol(col)
  38.   if div == 0 then
  39.     tPrint(l,c_text)
  40.   elseif div == 1 then
  41.     tPrint(divL,c_text)
  42.   end
  43.   bgCol(c_back)
  44. end
  45. function draw_menu(y,s)
  46.   setPos(1, y)
  47.   tPrint(" [  PROGRAMS    ] ",c_text)
  48.   tPrint(" [  SHELL       ] ",c_text)
  49.   tPrint(" [  LUA TERM    ] ",c_text)
  50.   tPrint(" [  LOG OUT     ] ",c_text)
  51.   tPrint(" [  REBOOT      ] ",c_text)
  52.   tPrint(" [  SHUTDOWN    ] ",c_text)
  53.   setPos(20,y+s)
  54.   tWrite("<",c_text)
  55. end
  56.  
  57. function draw_home()
  58.   clear()
  59.   bgCol(c_top)
  60.   tPrint("NAPALM OS                                    v1.0.0",c_text)
  61.   draw_line(1,c_top,1)
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement