Advertisement
MCFunRide

Graphix v2

Jun 23rd, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. -- Graphix API v2: Coded by datcoder1208 also known as MCFunRide
  2.  
  3. --[[
  4. Copyright (c) 2015, The CubeSpaceCC Team
  5. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,
  6. provided that the above copyright notice and this permission notice appear in all copies.
  7. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
  8. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
  9. DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
  10. OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  11. WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12. --]]
  13.  
  14. function center(yPos,sText)
  15. local w, h = term.getSize()
  16. local x = term.getCursorPos()
  17. x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
  18. term.setCursorPos(x,yPos)
  19. print(sText)
  20. end
  21.  
  22. function centerWrite(yPos,sText)
  23. local w, h = term.getSize()
  24. local x = term.getCursorPos()
  25. x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
  26. term.setCursorPos(x,yPos)
  27. write(sText)
  28. end
  29.  
  30.  
  31. function centerSlowPrint(yPos,sText)
  32. local w, h = term.getSize()
  33. local x = term.getCursorPos()
  34. x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
  35. term.setCursorPos(x,yPos)
  36. textutils.slowPrint(sText)
  37. end
  38.  
  39. function totalClear()
  40. term.setCursorPos(1,1)
  41. term.clear()
  42. end
  43.  
  44. function bgColor(color)
  45. term.setBackgroundColor(color)
  46. totalClear()
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement