mirror of
https://github.com/rm-code/Graphoon.git
synced 2024-11-16 18:24:22 +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
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user