SHARE
TWEET

CC: simple_paint1

hevohevo Apr 26th, 2016 (edited) 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- simple_paint1
  2. -- 簡易ペイントプログラム
  3.  
  4. -- Config
  5. local leftColor = colors.red
  6. local rightColor = colors.black
  7.  
  8. -- Functions
  9. function init()
  10.   term.setTextColor(colors.white)
  11.   term.setBackgroundColor(colors.black)
  12.   term.clear()
  13. end
  14.  
  15. function drawPoint(x,y,color)
  16.   term.setBackgroundColor(color)
  17.   term.setCursorPos(x,y)
  18.   term.write(" ")
  19. end
  20.  
  21. -- Main
  22. init()  -- 画面初期化
  23.  
  24. while true do
  25.   local event, button, x, y = os.pullEvent("mouse_click")
  26.   if button == 1 then
  27.     drawPoint(x, y, leftColor)
  28.   else
  29.     drawPoint(x,y, rightColor)
  30.   end
  31. end
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top