From d262b443e0675cba334ec146adbeb2806c7c48b9 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Mon, 1 Apr 2024 03:31:20 +0100 Subject: launch john --- framebuf.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'framebuf.lua') diff --git a/framebuf.lua b/framebuf.lua index 4f7ca3b..a19b7ee 100644 --- a/framebuf.lua +++ b/framebuf.lua @@ -166,14 +166,15 @@ local function get_char(fb, x, y) return string.char(char), fg, bg end -function M.resolution() - local w, h = term.getSize() +function M.resolution(mon) + local w, h = mon.getSize() return w * 2, h * 3 end function M:present(offsx, offsy) + print("PrESENT") offsx, offsy = offsx or 0, offsy or 0 - local w, h = term.getSize() + local w, h = mon.getSize() local pw, ph = M.resolution() local cols = {} local chars = {} @@ -191,11 +192,11 @@ function M:present(offsx, offsy) print("","2") local palette, map = median_cut(cols, 16) for i, color in ipairs(palette) do - term.setPaletteColor(2^(i - 1), color) + mon.setPaletteColor(2^(i - 1), color) end print("","3") for i = 1, w * h, w do - term.setCursorPos(1, (i - 1) / w) + mon.setCursorPos(1, (i - 1) / w) local blit_char, blit_fg, blit_bg = {}, {}, {} for i = i, i + w - 1 do local char, fg, bg = unpack(chars[i]) @@ -203,7 +204,7 @@ function M:present(offsx, offsy) table.insert(blit_fg, fg and hex_digits[map[fg]] or "1") table.insert(blit_bg, bg and hex_digits[map[bg]] or "1") end - term.blit( + mon.blit( table.concat(blit_char), table.concat(blit_fg), table.concat(blit_bg)) -- cgit v1.2.3