From c4c300ef047d052a437f7b0ea65f8a9542a4efe7 Mon Sep 17 00:00:00 2001 From: d Date: Wed, 30 Apr 2025 23:25:59 +0300 Subject: [PATCH] didnt need all that drawing pixels is easier than i thought lmao --- halyde/lib/raster.lua | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/halyde/lib/raster.lua b/halyde/lib/raster.lua index 281cfb8..c114157 100644 --- a/halyde/lib/raster.lua +++ b/halyde/lib/raster.lua @@ -1,42 +1,24 @@ local raster = {util = {}} +local ocelot = component.proxy(component.list("ocelot")()) +local gpu = component.proxy(component.list("gpu")()) + function raster.drawPixel(x, y, bg, fg) -- get original character for "merging" - local char = gpu.get(x, y)[0] + local char, fg, bg = gpu.get(x, y) -- thx wah if bg ~= nil then gpu.setBackground(bg) end if fg ~= nil then gpu.setForeground(fg) end -- convert from braille to char code - -- convert from - -- 1 4 1 2 - -- 2 5 -> 3 4 - -- 3 6 5 6 - -- 7 8 7 8 using complicate bit thingery - -- example would be 171 should be converted to 157 - -- or a more simple one: 16 to 4 -- bitwise or - -- unconvert -- print the thing - char = string.byte(char) + -- i do NOT need to convert the thing. ocelot.log(char) - char = formByte({getBit(char, 0), getBit(char, 2), getBit(char, 4), getBit(char, 1), getBit(char, 3), getBit(char, 5), getBit(char, 6), getBit(char, 7)}) - ocelot.log(char) -end - -function raster.util.XY2Braille(x, y) - return math.floor(x/2), math.floor(y/4) -end -function raster.util.Braille2XY(x, y) - return math.floor(x*2), math.floor(y*4) -end -function raster.util.getBit(a, which) - return 1 == ((a >> which) & 1); -end -function raster.util.formByte(a) - local x = 0 - for i = 1, 8 do - x = x+(a[i]< 0x28ff then -- check if char is not a braille character + char = 0 -- yes end - return x + -- now i just need to print the character + the new character but i forgot how to do it plus its late gn + ocelot.log(char) end return raster \ No newline at end of file