Files
World6-travelmap/src/main.lua

25 lines
647 B
Lua

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