FoxWorn3365

Hack - Main

Dec 4th, 2021
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. -- Hack OS - v0.19
  2. -- By FoxWorn3365
  3.  
  4. maxw, maxh = term.getSize()
  5. local function drawPixelInternal(xPos, yPos)
  6. term.setCursorPos(xPos, yPos)
  7. term.write(" ")
  8. end
  9.  
  10. local tColourLookup = {}
  11. for n = 1, 16 do
  12. tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  13. end
  14.  
  15. function drawFilledBox(startX, startY, endX, endY, nColour)
  16. if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  17. "number" or type(endY) ~= "number" or
  18. (nColour ~= nil and type(nColour) ~= "number") then
  19. error("Expected startX, startY, endX, endY, colour", 2)
  20. end
  21.  
  22. startX = math.floor(startX)
  23. startY = math.floor(startY)
  24. endX = math.floor(endX)
  25. endY = math.floor(endY)
  26.  
  27. if nColour then term.setBackgroundColor(nColour) end
  28. if startX == endX and startY == endY then
  29. drawPixelInternal(startX, startY)
  30. return
  31. end
  32.  
  33. local minX = math.min(startX, endX)
  34. if minX == startX then
  35. minY = startY
  36. maxX = endX
  37. maxY = endY
  38. else
  39. minY = endY
  40. maxX = startX
  41. maxY = startY
  42. end
  43.  
  44. for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  45. end
  46.  
  47. function clear()
  48. sfondo(colors.black)
  49. term.clear()
  50. term.setCursorPos(1, 1)
  51. end
  52.  
  53. function clearRed()
  54. sfondo(colors.red)
  55. term.clear()
  56. term.setCursorPos(1, 1)
  57. end
  58.  
  59. function titolo(testo)
  60. drawFilledBox(1, 1, maxw, 1, colors.blue)
  61. term.setCursorPos((maxw - #testo) / 2, 1)
  62. term.setTextColor(colors.white)
  63. term.write(testo)
  64. end
  65.  
  66. function alarm(testo, colore, y)
  67. drawFilledBox(1, y, maxw, y, colors[colore])
  68. term.setCursorPos((maxw - #testo) / 2, y)
  69. term.setTextColor(colors.white)
  70. term.write(testo)
  71. no()
  72. end
  73.  
  74.  
  75. function bottone(color, text, x, y)
  76. term.setBackgroundColor(colors[color])
  77. term.setTextColor(colors.white)
  78. term.setCursorPos(x, y)
  79. print(text)
  80. end
  81.  
  82. function no()
  83. term.setBackgroundColor(colors.white)
  84. term.setTextColor(colors.black)
  85. end
Advertisement
Add Comment
Please, Sign In to add comment