Advertisement
Guest User

ekran.lua

a guest
Apr 25th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local component = require "component"
  2. local event = require "event"
  3. local term = require "term"
  4. local redstone = component.transposer
  5. local gpu = component.gpu
  6.  
  7. local ingotMapping =
  8. {
  9. "**********AB****",
  10. "*******ABBCCB***"
  11. }
  12. local pixelA = 0X2C8000
  13. local pixelB = 0X2A7C00
  14. local pixelC = 0X3FC100
  15. local width, height = gpu.getResolution()
  16.  
  17. ----------------------------------------------------------------
  18.  
  19. function drawPixel(x, y, color)
  20.  
  21.   gpu.setBackground(color)
  22.   gpu.fill(x, y, 1, 1, " ")
  23.  
  24. end
  25.  
  26. function drawIngot()
  27.   for index, line in pairs(ingotMapping) do
  28.     for j = 1, string.len(line) do
  29.       currentPixel = string.sub(line, j, j + 1)
  30.       if currentPixel == "A" then
  31.         drawPixel(index, j, pixelA)
  32.       elseif currentPixel == "B" then
  33.         drawPixel(index, j, pixelB)
  34.       elseif currentPixel == "C" then
  35.         drawPixel(index, j, pixelC)
  36.       else
  37.         drawPixel(index, j, 0X000000)
  38.       end
  39.     end
  40.   end
  41. end
  42.  
  43.  
  44. function touchEventHandler(_, _, x, y)
  45.  
  46. end
  47.  
  48. drawIngot()
  49. --[[while true do
  50.   touchEventHandler(event.pull("touch"))
  51. end]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement