Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- exercise9_3
- -- 簡易ペイントプログラム
- -- Config
- local leftColor = colors.red
- local rightColor = colors.black
- -- Functions
- function init()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- function drawPoint(x,y,color)
- term.setBackgroundColor(color)
- term.setCursorPos(x,y)
- term.write(" ")
- end
- -- Main
- init() -- 画面初期化
- while true do
- local event, button, x, y = os.pullEvent("mouse_drag")
- if button == 1 then
- drawPoint(x, y, leftColor)
- else
- drawPoint(x,y, rightColor)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement