Thanks Kiran and Ravi.
GCUARQ2GJT3Y5K6LOOA6S7SOBMSXU7VV7LT355TOMFFPBQ3ZVYKAC
HWPK4SMPGZMXWXKCVX667676ZWN5Q2XZSTMVAADG7JNRF6XE45RQC
Z2CJVAPV3ETG6LVC6HX7D3KP66ZQWWVM2DTYWXG67PVLQJBZZIDQC
XX7G2FFJ4QCGQGD4REAW5QFHVYAKCFUPGZCK7L6DFGS5ISVBYBQQC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
IFGAJAF7UWM236QV4NWP2C67TJPQGXNBC2RTZCOWPJUJYYC2MMXAC
JCSLDGAH2F6AIY4Z6XM6K4LOMW7EFY3E4NF5YXLMHLTYTX3A4Z3QC
3XD6M3CFKZJR365MHXUWJ4HGSDTPYO6WYZ4RGW7ECBBITKVQX24QC
local j = insert_point(lines.current.points, coord(x-16), coord(y-lines.current.y))
lines.current.pending.p2 = j
local mx,my = coord(x-16), coord(y-lines.current.y)
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
local j = insert_point(lines.current.points, mx,my)
lines.current.pending.p2 = j
table.insert(lines.current.shapes, lines.current.pending)
end
if math.abs(mx-p1.x) > math.abs(my-p1.y) then
local j = insert_point(lines.current.points, mx, p1.y)
lines.current.pending.p2 = j
else
local j = insert_point(lines.current.points, p1.x, my)
lines.current.pending.p2 = j
if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
if math.abs(mx-p1.x) > math.abs(my-p1.y) then
local j = insert_point(lines.current.points, mx, p1.y)
lines.current.pending.p2 = j
else
local j = insert_point(lines.current.points, p1.x, my)
lines.current.pending.p2 = j
end
local p2 = lines.current.points[lines.current.pending.p2]
love.mouse.setPosition(16+pixels(p2.x), lines.current.y+pixels(p2.y))
table.insert(lines.current.shapes, lines.current.pending)
love.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, love.mouse.getX(),love.mouse.getY())
local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-drawing.y)
if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h then
return
end
love.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, pixels(mx)+left,pixels(my)+top)