The purpose is to write a text table 16x16 characters inside of it
with numbers to report inside of a text file, to then call them and draw them
any time using pixels of some colors.
the program isn't quite ready yet, but the purpose is simple.
The thing i would like is some help in writing this code and critiques
beacuse i struggle to make it correctly.
Maybe i'm too ambitious, but that would be awesome to create this little program.
Code: Select all
function graphic_write(a) -- write the graphics
writegraphic = io.open("graphlib/graph.lua", "w")
writegraphic:write(
"graphic"a" = {}
graphic"a"[1] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,} -- 0 corresponds to the red color.
graphic"a"[2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[3] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[4] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[5] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[6] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[7] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[8] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}
graphic"a"[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}")
end
function graphic_draw() -- call the graphics
local line
local colonne
for line=0, 16 do
for colonne=0, 16 do
love.graphics.setColor(color[map[line+1][colonne+1]])
love.graphics.rectangle("fill", colonne*16, line*16, 1, 1)
end
end
end