2023-08-26 21:05:48 +00:00
|
|
|
--Manage the AI nodes used by DEFCON.
|
|
|
|
local t = {}
|
|
|
|
local bmp = require 'bmp'
|
|
|
|
local lg = assert( love.graphics )
|
|
|
|
|
|
|
|
function t.load( filename )
|
|
|
|
local img, imgd = bmp.load( filename )
|
|
|
|
local nodes = {
|
|
|
|
visible = true,
|
|
|
|
att = {},
|
|
|
|
def = {},
|
|
|
|
img = img,
|
|
|
|
imgd = imgd }
|
|
|
|
|
|
|
|
print( "PIXEL: ", imgd:getPixel( 1, 1 ) )
|
|
|
|
|
|
|
|
return setmetatable( nodes, {__index = t } )
|
|
|
|
end
|
|
|
|
|
|
|
|
function t.draw( nodes )
|
|
|
|
lg.points( nodes.att )
|
|
|
|
lg.points( nodes.def )
|
|
|
|
lg.draw( nodes.img )
|
|
|
|
end
|
|
|
|
|
|
|
|
function t.save( nodes, filename )
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return t
|