new mode: circle

[?]
May 15, 2022, 4:14 AM
FMQ74DP324YKGBSTNMHBJMT6FYP5NI26MM43VUPGKODI5DVDCUXQC

Dependencies

  • [2] NL5J7Z5H new mode: polygon
  • [*] OTIBCAUJ love2d scaffold
  • [*] JCSLDGAH beginnings of support for multiple shapes
  • [*] H7OEU6WP experimental approach to combining keyboard and mouse while drawing
  • [*] 6LJZN727 handle chords

Change contents

  • edit in main.lua at line 178
    [2.403]
    [5.1962]
    elseif lines.current.pending.mode == 'circle' then
    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 center = lines.current.points[lines.current.pending.center]
    lines.current.pending.radius = math.dist(center.x,center.y, mx,my)
    table.insert(lines.current.shapes, lines.current.pending)
    end
  • edit in main.lua at line 205
    [2.594]
    [5.2374]
    elseif current_mode == 'circle' then
    local j = insert_point(drawing.points, coord(x-16), coord(y-drawing.y))
    drawing.pending = {mode=current_mode, center=j}
  • edit in main.lua at line 256
    [2.1078]
    [5.2834]
    elseif shape.mode == 'circle' then
    local center = drawing.points[shape.center]
    love.graphics.circle('line', pixels(center.x)+left,pixels(center.y)+top, pixels(shape.radius))
  • edit in main.lua at line 295
    [2.1535]
    [5.3110]
    elseif shape.mode == 'circle' then
    local center = drawing.points[shape.center]
    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
    local cx,cy = pixels(center.x)+left, pixels(center.y)+top
    love.graphics.circle('line', cx,cy, math.dist(cx,cy, love.mouse.getX(),love.mouse.getY()))
  • edit in main.lua at line 315
    [2.1617]
    [5.3287]
    elseif shape.mode == 'circle' then
    local center = drawing.points[shape.center]
    return math.dist(center.x,center.y, x,y) == shape.radius
  • edit in main.lua at line 413
    [2.2293]
    [6.141]
    elseif chord == 'C-c' then
    current_mode = 'circle'
  • edit in main.lua at line 539
    [7.464]
    function math.dist(x1,y1, x2,y2) return ((x2-x1)^2+(y2-y1)^2)^0.5 end