mirror of
https://github.com/rm-code/Graphoon.git
synced 2024-11-28 11:34:21 +00:00
Remove code for drawing the graph
Instead the draw function now takes a parameter of type function to which it passes the edges and nodes tables. This means the user can (and has to) handle the drawing of the graph.
This commit is contained in:
parent
1ad54dd376
commit
6b5bff63c3
11
Graph.lua
11
Graph.lua
@ -84,15 +84,8 @@ function Graph.new()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function self:draw()
|
function self:draw( func )
|
||||||
for _, edge in pairs( edges ) do
|
func( edges, nodes );
|
||||||
love.graphics.line( edge.origin:getX(), edge.origin:getY(), edge.target:getX(), edge.target:getY() );
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, nodeA in pairs( nodes ) do
|
|
||||||
love.graphics.points( nodeA:getX(), nodeA:getY() );
|
|
||||||
love.graphics.print( nodeA:getID(), nodeA:getX(), nodeA:getY() );
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self:getNodeAt(x, y, range)
|
function self:getNodeAt(x, y, range)
|
||||||
|
Loading…
Reference in New Issue
Block a user