Advertisement
massacring

Images

Jun 21st, 2025 (edited)
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.34 KB | None | 0 0
  1. local Images = {}
  2. Images.__index = Images
  3. Images.num1 = paintutils.parseImage([[
  4.  32
  5.   2
  6.   2
  7.   1
  8.  211
  9. ]])
  10. Images.num2 = paintutils.parseImage([[
  11.  32
  12. 3  1
  13.   2
  14.  2
  15. 2111
  16. ]])
  17. Images.num3 = paintutils.parseImage([[
  18.  32
  19. 3  2
  20.   1
  21. 2  1
  22.  21
  23. ]])
  24. Images.num4 = paintutils.parseImage([[
  25. 3  2
  26. 3  1
  27. 2211
  28.    1
  29.    1
  30. ]])
  31. Images.num5 = paintutils.parseImage([[
  32. 3322
  33. 2
  34.  211
  35.    1
  36. 211
  37. ]])
  38. Images.num6 = paintutils.parseImage([[
  39.  322
  40. 3
  41. 221
  42. 2  1
  43.  11
  44. ]])
  45. Images.num7 = paintutils.parseImage([[
  46. 3322
  47.    1
  48.   1
  49.  1
  50. 2
  51. ]])
  52. Images.num8 = paintutils.parseImage([[
  53.  32
  54. 3  1
  55.  21
  56. 2  1
  57.  11
  58. ]])
  59. Images.num9 = paintutils.parseImage([[
  60.  32
  61. 3  1
  62.  211
  63.    1
  64. 211
  65. ]])
  66. Images.num0 = paintutils.parseImage([[
  67.  32
  68. 3  1
  69. 2  1
  70. 2  1
  71.  11
  72. ]])
  73. Images.jack = paintutils.parseImage([[
  74. 332
  75.    2
  76.    1
  77. 2  1
  78.  21
  79. ]])
  80. Images.queen = paintutils.parseImage([[
  81.  32
  82. 3  2
  83. 2  1
  84. 2 1
  85.  1 1
  86. ]])
  87. Images.king = paintutils.parseImage([[
  88. 3  1
  89. 3 2
  90. 22
  91. 2 1
  92. 2  1
  93. ]])
  94. Images.ace = paintutils.parseImage([[
  95.  32
  96. 3  1
  97. 2211
  98. 2  1
  99. 2  1
  100. ]])
  101. Images.joker = paintutils.parseImage([[
  102.   649
  103.   5aa9
  104.     a9 9
  105.   a9aaaa95
  106.  5aaaaaa456
  107. 654aaaa9 4
  108.  4  9999
  109.     2211
  110. ]])
  111. Images.spade = paintutils.parseImage([[
  112.   2
  113.  231
  114. 23211
  115.   1
  116.  211
  117. ]])
  118. Images.heart = paintutils.parseImage([[
  119.  5 4
  120. 56544
  121. 55544
  122.  544
  123.   4
  124. ]])
  125. Images.club = paintutils.parseImage([[
  126.  222
  127. 23211
  128. 22111
  129.   1
  130.  211
  131. ]])
  132. Images.diamond = paintutils.parseImage([[
  133.   5
  134.  564
  135. 56544
  136.  544
  137.   4
  138. ]])
  139. Images.bust = paintutils.parseImage([[
  140.  32222  3     2   3222   32221
  141. 3     2 3     2  3    1 3  2  1
  142. 2     2 2     2 2          2
  143. 2    2  2     2  2         2
  144. 22222   2     1   222      2
  145. 2    1  2     1      1     2
  146. 2     1  2   1        1    1
  147. 2     1  2   1  2    1     1
  148.  21111    211    2211     211
  149. ]])
  150. Images.win = paintutils.parseImage([[
  151.  3   2   3221 3    2
  152. 3     2 3 2   32    2
  153. 2     2   2   2 2   2
  154. 2     1   2   2 2   1
  155.  2   1    2   2  2  1
  156.  2 2 1    1   2   2 1
  157.  2 2 1    1   2   1 1
  158.   2 1     1 1 2    11
  159.   2 1   2111   2    1
  160. ]])
  161. Images.draw = paintutils.parseImage([[
  162.  3222   32222     322    3   2
  163. 3    2  3    2   3   2  3     2
  164. 2     2 2     2 2     1 2     2
  165. 2     1 2     1 2     1 2     1
  166. 2     1 2    1  2222211  2   1
  167. 2     1 22221   2     1  2 2 1
  168. 2     1 2    1  2     1  2 2 1
  169. 2    1  2     1 2     1   2 1
  170.  2211   2     1 2     1   2 1
  171. ]])
  172.  
  173. local cardLength = 13
  174. local cardHeight = 13
  175.  
  176. function Images:drawJoker(window, x, y)
  177.     local oldTerm = term.redirect(window)
  178.     local borderColor = 2
  179.     local background = 1
  180.  
  181.     term.setCursorPos(x+1, y)
  182.     term.setBackgroundColor(borderColor)
  183.     term.write(string.rep(" ", cardLength))
  184.  
  185.     for i=1, cardHeight, 1 do
  186.         term.setCursorPos(x, y+i)
  187.         term.setBackgroundColor(borderColor)
  188.         term.write(" ")
  189.  
  190.         term.setCursorPos(x+1, y+i)
  191.         term.setBackgroundColor(background)
  192.         term.write(string.rep(" ", cardLength))
  193.  
  194.         term.setCursorPos(x+1+cardLength, y+i)
  195.         term.setBackgroundColor(borderColor)
  196.         term.write(" ")
  197.     end
  198.  
  199.     term.setCursorPos(x+1, y+1+cardHeight)
  200.     term.setBackgroundColor(borderColor)
  201.     term.write(string.rep(" ", cardLength))
  202.  
  203.     term.setBackgroundColor(borderColor)
  204.     for i=1,cardHeight,(cardHeight-1) do
  205.         term.setCursorPos(x+1, y+i)
  206.         term.write(" ")
  207.         term.setCursorPos(x+cardLength, y+i)
  208.         term.write(" ")
  209.     end
  210.  
  211.     paintutils.drawImage(Images.joker, x+2, y+3)
  212.     term.redirect(oldTerm)
  213. end
  214.  
  215. function Images:drawCard(window, x, y, num, suit)
  216.     local oldTerm = term.redirect(window)
  217.     local borderColor = 2
  218.     local numBackground = 1
  219.     local suitBackgroundPrimary
  220.     local suitBackgroundSecondary
  221.     local suitImg
  222.  
  223.     if suit == "spade" or suit == "club" then
  224.         suitBackgroundPrimary = 32
  225.         suitBackgroundSecondary = 16
  226.     elseif suit == "heart" or suit == "diamond" then
  227.         suitBackgroundPrimary = 8
  228.         suitBackgroundSecondary = 4
  229.     end
  230.  
  231.     if suit == "spade" then
  232.         suitImg = Images.spade
  233.     elseif suit == "heart" then
  234.         suitImg = Images.heart
  235.     elseif suit == "club" then
  236.         suitImg = Images.club
  237.     elseif suit == "diamond" then
  238.         suitImg = Images.diamond
  239.     end
  240.  
  241.     term.setCursorPos(x+1, y)
  242.     term.setBackgroundColor(borderColor)
  243.     term.write(string.rep(" ", cardLength))
  244.  
  245.     for i=1, cardHeight, 1 do
  246.         term.setCursorPos(x, y+i)
  247.         term.setBackgroundColor(borderColor)
  248.         term.write(" ")
  249.  
  250.         for j=1, cardLength, 1 do
  251.             term.setCursorPos(x+j, y+i)
  252.             local diagonal_forward = j + i <= math.floor((cardLength + cardHeight) / 2)+1
  253.             local diagonal_backward = j - i >= 1
  254.             if (i == j) then
  255.                 term.setBackgroundColor(borderColor)
  256.             elseif (diagonal_backward) then
  257.                 if (diagonal_forward) then
  258.                     term.setBackgroundColor(suitBackgroundPrimary)
  259.                 else
  260.                     term.setBackgroundColor(suitBackgroundSecondary)
  261.                 end
  262.             else
  263.                 term.setBackgroundColor(numBackground)
  264.             end
  265.             term.write(" ")
  266.         end
  267.  
  268.         term.setCursorPos(x+1+cardLength, y+i)
  269.         term.setBackgroundColor(borderColor)
  270.         term.write(" ")
  271.     end
  272.  
  273.     term.setCursorPos(x+1, y+1+cardHeight)
  274.     term.setBackgroundColor(borderColor)
  275.     term.write(string.rep(" ", cardLength))
  276.  
  277.     term.setBackgroundColor(borderColor)
  278.     for i=1,cardHeight,(cardHeight-1) do
  279.         term.setCursorPos(x+1, y+i)
  280.         term.write(" ")
  281.         term.setCursorPos(x+cardLength, y+i)
  282.         term.write(" ")
  283.     end
  284.  
  285.     paintutils.drawImage(suitImg, x+cardLength-5, y+2)
  286.     paintutils.drawImage(num, x+2, y+cardHeight-5)
  287.     term.redirect(oldTerm)
  288. end
  289.  
  290. function Images:drawFaceDown(window, x, y)
  291.     local oldTerm = term.redirect(window)
  292.     local borderColor = 1
  293.     local primaryColor = 32
  294.     local secondaryColor = 16
  295.  
  296.     term.setCursorPos(x+1, y)
  297.     term.setBackgroundColor(borderColor)
  298.     term.write(string.rep(" ", cardLength))
  299.  
  300.     for i=1, cardHeight, 1 do
  301.         term.setCursorPos(x, y+i)
  302.         term.setBackgroundColor(borderColor)
  303.         term.write(" ")
  304.  
  305.         for j=1, cardLength, 1 do
  306.             if (i + j) % 2 == 1 then
  307.                 term.setBackgroundColor(primaryColor)
  308.             else
  309.                 term.setBackgroundColor(secondaryColor)
  310.             end
  311.             term.setCursorPos(x+j, y+i)
  312.             term.write(" ")
  313.         end
  314.  
  315.         term.setCursorPos(x+1+cardLength, y+i)
  316.         term.setBackgroundColor(borderColor)
  317.         term.write(" ")
  318.     end
  319.  
  320.     term.setCursorPos(x+1, y+1+cardHeight)
  321.     term.setBackgroundColor(borderColor)
  322.     term.write(string.rep(" ", cardLength))
  323.  
  324.     term.setBackgroundColor(borderColor)
  325.     for i=1,cardHeight,(cardHeight-1) do
  326.         term.setCursorPos(x+1, y+i)
  327.         term.write(" ")
  328.         term.setCursorPos(x+cardLength, y+i)
  329.         term.write(" ")
  330.     end
  331.  
  332.     term.redirect(oldTerm)
  333. end
  334.  
  335. function Images:drawBust(window, x, y)
  336.     local oldTerm = term.redirect(window)
  337.     local length = 34
  338.     local height = 13
  339.     x = x - math.floor(length/2)
  340.     y = y - math.floor(height/2)
  341.     for i=1,height,1 do
  342.         if i == 1 or i == height then
  343.             term.setBackgroundColor(2)
  344.         elseif (i > 6) then
  345.             term.setBackgroundColor(512)
  346.         else
  347.             term.setBackgroundColor(1024)
  348.         end
  349.         term.setCursorPos(x, y+i-1)
  350.         term.write(string.rep(" ", length))
  351.  
  352.         term.setBackgroundColor(2)
  353.         term.setCursorPos(x, y+i-1)
  354.         term.write(" ")
  355.         term.setCursorPos(x + length, y+i-1)
  356.         term.write(" ")
  357.     end
  358.  
  359.     paintutils.drawImage(Images.bust, x+2, y+2)
  360.  
  361.     term.redirect(oldTerm)
  362. end
  363.  
  364. function Images:drawWin(window, x, y)
  365.     local oldTerm = term.redirect(window)
  366.     local length = 24
  367.     local height = 13
  368.     x = x - math.floor(length/2)
  369.     y = y - math.floor(height/2)
  370.     for i=1,height,1 do
  371.         if i == 1 or i == height then
  372.             term.setBackgroundColor(2)
  373.         elseif (i > 6) then
  374.             term.setBackgroundColor(512)
  375.         else
  376.             term.setBackgroundColor(1024)
  377.         end
  378.         term.setCursorPos(x, y+i-1)
  379.         term.write(string.rep(" ", length))
  380.  
  381.         term.setBackgroundColor(2)
  382.         term.setCursorPos(x, y+i-1)
  383.         term.write(" ")
  384.         term.setCursorPos(x + length, y+i-1)
  385.         term.write(" ")
  386.     end
  387.  
  388.     paintutils.drawImage(Images.win, x+2, y+2)
  389.  
  390.     term.redirect(oldTerm)
  391. end
  392.  
  393. function Images:drawDraw(window, x, y)
  394.     local oldTerm = term.redirect(window)
  395.     local length = 34
  396.     local height = 13
  397.     x = x - math.floor(length/2)
  398.     y = y - math.floor(height/2)
  399.     for i=1,height,1 do
  400.         if i == 1 or i == height then
  401.             term.setBackgroundColor(2)
  402.         elseif (i > 6) then
  403.             term.setBackgroundColor(512)
  404.         else
  405.             term.setBackgroundColor(1024)
  406.         end
  407.         term.setCursorPos(x, y+i-1)
  408.         term.write(string.rep(" ", length))
  409.  
  410.         term.setBackgroundColor(2)
  411.         term.setCursorPos(x, y+i-1)
  412.         term.write(" ")
  413.         term.setCursorPos(x + length, y+i-1)
  414.         term.write(" ")
  415.     end
  416.  
  417.     paintutils.drawImage(Images.draw, x+2, y+2)
  418.  
  419.     term.redirect(oldTerm)
  420. end
  421.  
  422. return Images
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement