attempted to use Graphoon, but it just crashes
This commit is contained in:
24
src/main.lua
Normal file
24
src/main.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local Graphoon = require "lib.Graphoon"
|
||||
|
||||
local graph = Graphoon.Graph.new()
|
||||
|
||||
-- it just crashes :D
|
||||
graph:addNode("Name", 100, 100, true) -- magic numbers are a position and anchor to that position
|
||||
graph:addNode("Another")
|
||||
graph:connectIDs("Name", "Another")
|
||||
|
||||
function love.draw()
|
||||
graph:draw(function(node)
|
||||
local x, y = node:getPosition()
|
||||
love.graphics.circle("fill", x, y, 5)
|
||||
end,
|
||||
function(edge)
|
||||
local origin_x, origin_y = edge.origin:getPosition()
|
||||
local target_x, target_y = edge.target:getPosition()
|
||||
love.graphics.line(origin_x, origin_y, target_x, target_y)
|
||||
end)
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
graph:update(dt)
|
||||
end
|
||||
Reference in New Issue
Block a user