Advertisement
Guest User

ekran.lua

a guest
Apr 25th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 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. "*******ABBCCB***"
  12. }
  13. local pixelA = 0X2C8000
  14. local pixelB = 0X2A7C00
  15. local pixelC = 0X3FC100
  16. local width, height = gpu.getResolution()
  17.  
  18. ----------------------------------------------------------------
  19.  
  20. function drawPixel(x, y, color)
  21.  
  22.   if color == "A" then
  23.     gpu.setBackground(0X2C8000)
  24.     gpu.fill(x, y, 1, 1, " ")
  25.   elseif color == "B" then
  26.     gpu.setBackground(0X2A7C00)
  27.     gpu.fill(x, y, 1, 1, " ")
  28.   elseif color == "C" then
  29.     gpu.setBackground(0X3FC100)
  30.     gpu.fill(x, y, 1, 1, " ")
  31.   end
  32.  
  33. end
  34.  
  35. function drawIngot()
  36.   for index, line in pairs(ingotMapping) do
  37.     for j = 1, string.len(line) do
  38.       currentPixel = string.sub(line, j, j + 1)
  39.       if currentPixel == "A" then
  40.         drawPixel(j, index, "A")
  41.       elseif currentPixel == "B" then
  42.         drawPixel(j, index, "B")
  43.       elseif currentPixel == "C" then
  44.         drawPixel(j, index, "C")
  45.       elseif currentPixel == "*" then
  46.         drawPixel(j, index, "*")
  47.       end
  48.     end
  49.   end
  50. end
  51.  
  52.  
  53. function touchEventHandler(_, _, x, y)
  54.  
  55. end
  56.  
  57. drawIngot()
  58. --[[while true do
  59.   touchEventHandler(event.pull("touch"))
  60. end]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement