summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-01 04:34:21 +0100
committerubq323 <ubq323@ubq323.website>2024-04-01 04:34:21 +0100
commite94740c9a4cf94a100a1e6bf6ecce361cb10a668 (patch)
treef8ae443a67f5f8bb1cf3d0e49632327a59fa7faf
parentc81b84f0577a99ff9c1ebfdd3bdcfd672cbae944 (diff)
launch john
-rw-r--r--framebuf.lua10
-rw-r--r--john.lua1
2 files changed, 8 insertions, 3 deletions
diff --git a/framebuf.lua b/framebuf.lua
index 77f17e6..614f48b 100644
--- a/framebuf.lua
+++ b/framebuf.lua
@@ -53,6 +53,10 @@ function M:rect(x1, y1, x2, y2, r, g, b)
end
end
+function M:get_size()
+ return #self, #(self[1] or {})
+end
+
function M:ppm(data, x, y)
if type(data) ~= "string" then
local f = data
@@ -178,7 +182,7 @@ function M:present(mon, offsx, offsy)
local pw, ph = M.resolution(mon)
local cols = {}
local chars = {}
- print("","1")
+ -- print("","1")
for y = offsy + 1, offsy + ph, 3 do
for x = offsx + 1, offsx + pw, 2 do
local char, fg, bg = get_char(self, x, y)
@@ -189,12 +193,12 @@ function M:present(mon, offsx, offsy)
end
end
end
- print("","2")
+ -- print("","2")
local palette, map = median_cut(cols, 16)
for i, color in ipairs(palette) do
mon.setPaletteColor(2^(i - 1), color)
end
- print("","3")
+ -- print("","3")
for i = 1, w * h, w do
mon.setCursorPos(1, (i - 1) / w)
local blit_char, blit_fg, blit_bg = {}, {}, {}
diff --git a/john.lua b/john.lua
index bdbae96..fa6bd08 100644
--- a/john.lua
+++ b/john.lua
@@ -15,6 +15,7 @@ if monitors == nil or #monitors < 1 then
end
fb:ppm(fs.open("img/john.pnm","rb"))
+print("size!!",fb:get_size())
local xoffs = 0
for ix,iname in ipairs(monitors) do