XX7G2FFJ4QCGQGD4REAW5QFHVYAKCFUPGZCK7L6DFGS5ISVBYBQQC NZ7V4BVSRL4CYV3BGUSJQV7DDVFPSLYPAVOSJO5LAQEVEJIJBKBQC 6PUNJS5BSLTYMYMN4JFD7YDEGVQLM5PGAT7PQIG5NIAKLTM5T4PQC IZZVOCLB7KB4ZNQ35OL466MHWOK3XZMOS7ZPFLHUFQ47LJLQQQ3QC 6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC QU7NHFOVGFSKQ3CWG7EF2Q7GKP3Z6FHGTIDXFHHMSFL6XMUOHMEAC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC love.graphics.draw(text, 12, i*15)
if line == '' thenbutton('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0},icon = function(x, y)love.graphics.setColor(0.7,0.7,0.7)love.graphics.rectangle('line', x,y, 12,12)love.graphics.line(4,y+6, 16,y+6)love.graphics.line(10,y, 10,y+12)love.graphics.setColor(0, 0, 0)end,onpress1 = function()table.insert(lines, i, {y=y, w=400, h=200, pending={}, shapes={}})end})elseif type(line) == 'table' then-- line drawinglove.graphics.setColor(0,0,0)line.y = ylove.graphics.rectangle('line', 12,y, line.w,line.h)y = y+line.hfor _,shape in ipairs(line.shapes) doprev = nilfor _,point in ipairs(shape) doif prev thenlove.graphics.line(prev.x,prev.y, point.x,point.y)endprev = pointendendprev = nilfor _,point in ipairs(line.pending) doif prev thenlove.graphics.line(prev.x,prev.y, point.x,point.y)endprev = pointendelselove.graphics.draw(text, 25,y, 0, 1.5)end
if love.mouse.isDown('1') thenfor i, line in ipairs(lines) doif type(line) == 'table' thenlocal y = love.mouse.getY()if y >= line.y and y < line.y + line.h thenlines.current = lineprocess_drag(line,love.mouse.getX(),love.mouse.getY())endendendendendfunction process_drag(drawing, x,y)table.insert(drawing.pending, {x=x, y=y})
button_handlers = {}-- draw button and queue up event handlersfunction button(name, params)love.graphics.setColor(params.color[1], params.color[2], params.color[3])love.graphics.rectangle('fill', params.x,params.y, params.w,params.h, 5,5)if params.icon then params.icon(params.x, params.y) endtable.insert(button_handlers, params)end-- process button event handlersfunction propagate_to_button_handers(x, y, button)for _,ev in ipairs(button_handlers) doif x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h thenif ev.onpress1 and button == 1 then ev.onpress1() endendendend