1
0
Fork 0
cc-stuff/btccshow.lua

27 lines
590 B
Lua
Raw Normal View History

2024-01-21 18:46:33 +03:00
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