Advertisement
Guest User

ekran.lua

a guest
Apr 25th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local component = require "component"
  2. local event = require "event"
  3. local term = require "term"
  4. local transoser = component.transposer
  5. local redstone = component.redstone
  6. local gpu = component.gpu
  7.  
  8. local ingotMapping =
  9. {
  10. "**********AB****",
  11. "*******AAABBA***",
  12. "****AAABCCCCBA**",
  13. "*AAABDDCCCCCCBA*",
  14. "ABDDDCCCCCBAAABA",
  15. "ADBCCCCBAAABAAAA",
  16. "ADCABAAABBBBBBBA",
  17. "ACBBABBBBBBBBBBA",
  18. "ABBBABBBBBBBAAA*",
  19. "*ABBBBBBAAA*****",
  20. "**ABABAAA*******",
  21. "***AAA**********"
  22. }
  23. local pixelA = 0X2C8000
  24. local pixelB = 0X3FC100
  25. local pixelC = 0X56FF0A
  26. local pixelD = 0X9FFF57
  27. local w, h = gpu.getResolution()
  28.  
  29. ----------------------------------------------------------------
  30.  
  31. function drawPixel(x, y, color)  
  32.   if color == "A" then
  33.     gpu.setBackground(0X2C8000)
  34.     gpu.fill(x, y, 1, 1, " ")
  35.   elseif color == "B" then
  36.     gpu.setBackground(0X3FC100)
  37.     gpu.fill(x, y, x, 1, " ")
  38.   elseif color == "C" then
  39.     gpu.setBackground(0X56FF0A)
  40.     gpu.fill(x, y, 1, 1, " ")
  41.   elseif color == "D" then
  42.     gpu.setBackground(0X9FFF57)
  43.   end
  44.  
  45. end
  46.  
  47. function drawIngot()
  48.   for index, line in pairs(ingotMapping) do
  49.     for j = 1, string.len(line) do
  50.       currentPixel = string.sub(line, j, j)
  51.       if currentPixel == "A" then
  52.         drawPixel(j, index, "A")
  53.       elseif currentPixel == "B" then
  54.         drawPixel(j, index, "B")
  55.       elseif currentPixel == "C" then
  56.         drawPixel(j, index, "C")
  57.       elseif currentPixel == "D" then
  58.         drawPixel(j, index, "D")
  59.       end
  60.     end
  61.   end
  62. end
  63.  
  64.  
  65. function touchEventHandler(_, _, x, y)
  66.  
  67. end
  68.  
  69. term.clear()
  70. drawIngot()
  71. --[[while true do
  72.   touchEventHandler(event.pull("touch"))
  73. end]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement