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:
Robert Machmer 2015-12-23 08:38:42 +01:00
parent 1ad54dd376
commit 6b5bff63c3

View File

@ -84,15 +84,8 @@ function Graph.new()
end
end
function self:draw()
for _, edge in pairs( edges ) do
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
function self:draw( func )
func( edges, nodes );
end
function self:getNodeAt(x, y, range)