summaryrefslogtreecommitdiff
path: root/john.lua
blob: b0835391218fb8e3a008a01feb2f2949f5d536fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
local framebuf = require("framebuf")
local fb = framebuf.new()

local function splitw(str)
	local res = {}
	for s in str:gmatch("%S+") do
		table.insert(res,s)
	end
	return res
end

local monitors = splitw(settings.get"john.monitors")
if monitors == nil or #monitors < 1 then
	error("need john.monitors setting")
end

fb:ppm(fs.open("img/john.pnm","rb"))
local xoffs = 0

for ix,iname in ipairs(monitors) do
	print("doing",ix,iname)
	local mon = peripheral.wrap(iname)
	mon.clear()
	mon.setTextScale(0.5)
	local t = term.redirect(mon)
	local _, bee = pcall(function() fb:present(xoffs,0) end)
	term.redirect(t)
	xoffs = xoffs + (mon.getSize())*2 + 8
	print(bee)
end

-- local m = peripheral.wrap "bottom"
-- m.clear()
-- m.setTextScale(0.5)
-- local t = term.redirect(m)
-- local _, bee = pcall(function()
--     fb:present()
-- end)
-- term.redirect(t)
-- print(bee)