FoxWorn3365

Gestione Corrente Titanus Elios

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