new mode: polygon
[?]
May 15, 2022, 3:50 AM
NL5J7Z5H577GPKGNS5TDRVWC55VLA2UCZE34F5WR4AJ5N265UECACDependencies
- [2]
HWPK4SMPnew mode: manhattan - [*]
OTIBCAUJlove2d scaffold - [*]
JCSLDGAHbeginnings of support for multiple shapes - [*]
S5JIPJPI. - [*]
IFGAJAF7add a level of indirection to vertices of shapes - [*]
G77XIN7Mselecting a stroke - [*]
6LJZN727handle chords - [*]
H7OEU6WPexperimental approach to combining keyboard and mouse while drawing
Change contents
- edit in main.lua at line 171
elseif lines.current.pending.mode == 'polygon' thenlocal mx,my = coord(x-16), coord(y-lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h thenlocal j = insert_point(lines.current.points, mx,my)table.insert(lines.current.shapes, lines.current.pending)endtable.insert(lines.current.shapes, lines.current.pending) - edit in main.lua at line 195
elseif current_mode == 'polygon' thenlocal j = insert_point(drawing.points, coord(x-16), coord(y-drawing.y))drawing.pending = {mode=current_mode, vertices={j}} - edit in main.lua at line 234
elseif shape.mode == 'polygon' thenlocal prev = nilfor _,point in ipairs(shape.vertices) dolocal curr = drawing.points[point]if prev thenlove.graphics.line(pixels(prev.x)+left,pixels(prev.y)+top, pixels(curr.x)+left,pixels(curr.y)+top)endprev = currend-- close the looplocal curr = drawing.points[shape.vertices[1]]love.graphics.line(pixels(prev.x)+left,pixels(prev.y)+top, pixels(curr.x)+left,pixels(curr.y)+top) - edit in main.lua at line 271
elseif shape.mode == 'polygon' then-- don't close the loop on a pending polygonlocal prev = nilfor _,point in ipairs(shape.vertices) dolocal curr = drawing.points[point]if prev thenlove.graphics.line(pixels(prev.x)+left,pixels(prev.y)+top, pixels(curr.x)+left,pixels(curr.y)+top)endprev = currendlove.graphics.line(pixels(prev.x)+left,pixels(prev.y)+top, love.mouse.getX(),love.mouse.getY()) - edit in main.lua at line 292
elseif shape.mode == 'polygon' thenreturn on_polygon(x,y, drawing, shape) - edit in main.lua at line 343
function on_polygon(x,y, drawing, shape)local prevfor _,p in ipairs(shape.vertices) doif prev thenif on_line(x,y, drawing, {p1=prev, p2=p}) thenreturn trueendendprev = pendreturn on_line(x,y, drawing, {p1=shape.vertices[1], p2=shape.vertices[#shape.vertices]})end - edit in main.lua at line 382[10.141][10.141]
elseif chord == 'C-g' thencurrent_mode = 'polygon'elseif love.mouse.isDown('1') and chord == 'p' and current_mode == 'polygon' thenlocal drawing = current_drawing()local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-drawing.y)local j = insert_point(drawing.points, mx,my)table.insert(drawing.pending.vertices, j)