is it possible to draw a 2d table of lookup colors?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Shadowblitz16
Prole
Posts: 42
Joined: Wed Oct 28, 2015 11:18 pm

is it possible to draw a 2d table of lookup colors?

Post by Shadowblitz16 » Sun Mar 11, 2018 9:33 pm

is it possible to draw a 2d table of lookup colors in love2d?

for example something like this?

Code: Select all

tile =  
{
	{1,0,1},
	{0,0,0},
	{1,0,1}
}
pal  =  {0x000000, 0xFFFFFF}

function convert_to_drawable(tile, pal)
        local drawable = {}
	for y=0, tile.length()    do
	for x=0, tile[y].length() do
		table.insert(drawable, pal[tile[x][y]])
	end
	end
	return drawable
love.graphics.draw(convert_to_drawable(tile, pal), 3, 3)

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests