forked from hkc/cc-stuff
1
0
Fork 0
cc-stuff/bigterm-hello.lua

100 lines
2.6 KiB
Lua
Raw Permalink Normal View History

local bigterm = require("bigterm")({
{ p = peripheral.wrap("monitor_1"), x = 1, y = 1 },
{ p = peripheral.wrap("monitor_2"), x = 2, y = 1 },
{ p = peripheral.wrap("monitor_3"), x = 1, y = 2 },
{ p = peripheral.wrap("monitor_4"), x = 2, y = 2 },
{ p = peripheral.wrap("monitor_5"), x = 1, y = 3 },
{ p = peripheral.wrap("monitor_6"), x = 2, y = 3 },
}, {
palette = {
[colors.white] = 0xEFEFEF,
[colors.orange] = 0xEF712A,
[colors.magenta] = 0xCF43EA,
[colors.lightBlue] = 0x5643EF,
[colors.yellow] = 0xEFCF42,
[colors.lime] = 0x43FA99,
[colors.pink] = 0xEF7192,
[colors.gray] = 0x676767,
[colors.lightGray] = 0xAAAAAA,
[colors.cyan] = 0x42DFFA,
[colors.blue] = 0x7853FF,
[colors.brown] = 0xb18624,
[colors.green] = 0x00FF00,
[colors.red] = 0xFF0000,
[colors.black] = 0x000000
},
scale = 0.5
})
bigterm._forEachMonitor(function(mon, i)
print(mon.x, mon.y, mon.p.getSize())
end)
--bigterm._blitpixel(1, 21, "A")
local w, h = bigterm.getSize()
print(w, h)
--for y = 1, h do
-- for x = 1, w do
-- bigterm._blitpixel(
-- x,
-- y,
-- string.char((x + y * 16 - 16) % 256),
-- string.format("%x", (x - y) % 16),
-- string.format("%x", (x + y) % 16)
-- )
-- end
--end
bigterm.setTextColor(colors.white)
bigterm.setBackgroundColor(colors.black)
bigterm.clear()
if false then
local lines = require("cc.strings").wrap(io.lines("cc-stuff/beemovie.txt")(), w)
for i, line in ipairs(lines) do
bigterm.setCursorPos(1, i)
bigterm.setTextColor(2 ^ (i % 2))
bigterm.write(line)
if i == h then break end
end
end
for t = 0, 31 do
for y = 1, h do
local res = {}
for x = 0, w do
table.insert(res, string.format("%x", bit.bxor(x, y * t + 1) % 16))
end
res = table.concat(res)
bigterm.setCursorPos(1, y)
bigterm.blit(res, res, string.rep("f", #res))
end
os.sleep(0.05)
end
local ccpi = require("ccpi")
local img = ccpi.load("cc-stuff/cpi-images/cute.cpi")
local ys = {}
for y = 1, img.h do table.insert(ys, y) end
for i = 1, #ys do
local a, b = math.random(1, #ys), math.random(1, #ys)
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)
os.sleep(0.05)
end
for i = 1, 16 do
bigterm.setPaletteColor(bit.blshift(1, i - 1), img.palette[i])
os.sleep(0.10)
end