27 lines
590 B
Lua
27 lines
590 B
Lua
|
local args = { ... }
|
||
|
local ccpi = require("ccpi")
|
||
|
local bigterm = require("bigterm").fromFile("/bigterm.json")
|
||
|
|
||
|
local img, err = ccpi.load(args[1])
|
||
|
if not img then
|
||
|
printError(err)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local ys = {}
|
||
|
for y = 1, img.h do table.insert(ys, y) end
|
||
|
|
||
|
for i = 1, math.floor((#ys) / 2), 2 do
|
||
|
local a, b = i, (#ys - 1) - i + 1
|
||
|
ys[a], ys[b] = ys[b], ys[a]
|
||
|
end
|
||
|
|
||
|
for i, y in ipairs(ys) do
|
||
|
bigterm.setCursorPos(1, y)
|
||
|
bigterm.blit(img.lines[y].s, img.lines[y].fg, img.lines[y].bg)
|
||
|
end
|
||
|
|
||
|
for i = 1, 16 do
|
||
|
bigterm.setPaletteColor(bit.blshift(1, i - 1), img.palette[i])
|
||
|
end
|