summaryrefslogtreecommitdiff
path: root/framebuf.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-01 03:31:20 +0100
committerubq323 <ubq323@ubq323.website>2024-04-01 03:31:20 +0100
commitd262b443e0675cba334ec146adbeb2806c7c48b9 (patch)
treec383a0cfd28f045cb846d7356ccc066392962aff /framebuf.lua
parent1f471149968dd51518213c3e2f3a3618daabff8d (diff)
launch john
Diffstat (limited to 'framebuf.lua')
-rw-r--r--framebuf.lua13
1 files changed, 7 insertions, 6 deletions
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))