theCPU

Paint on the monitor (OpenСomputers)

Oct 1st, 2017
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- English:
  2. -- A program for drawing in the monitor and output coordinates X and Y
  3. -- Left mouse button paints right erases
  4.  
  5. -- Russian:
  6. -- Программа для рисования на мониторе и вывода координатов X и Y
  7. -- Левая кнопка мыши красит правая стирает
  8.  
  9. local event = require("event")
  10. local component = require("component")
  11.  
  12. while true do
  13. local e = {event.pull()}
  14.  if e[1] == "touch" or e[1] == "drag" then
  15.  component.gpu.fill(1,1,9,2," ")
  16.  component.gpu.set(1,1,"X = "..e[3])
  17.  component.gpu.set(1,2,"Y = "..e[4])
  18.    if e[5] == 1 then
  19.     component.gpu.set(e[3],e[4]," ")
  20.    else
  21.     component.gpu.set(e[3],e[4],"█")
  22.    end
  23.  end
  24. end
RAW Paste Data