diff --git a/async-bot.py b/async-bot.py index ac730b5..497f7b8 100644 --- a/async-bot.py +++ b/async-bot.py @@ -226,10 +226,10 @@ async def amain() -> None: if a < 128: continue - ndx_start = (x + ox + (y + oy) * 577) * 3 - mgr.put_index(ndx_start, r > 128) - mgr.put_index(ndx_start + 1, g > 128) - mgr.put_index(ndx_start + 2, b > 128) + start_ndx = (x + ox + (y + oy) * 577) * 3 + mgr.put_index(start_ndx, r > 128) + mgr.put_index(start_ndx + 1, g > 128) + mgr.put_index(start_ndx + 2, b > 128) elif elem["type"] == "rgb565": ox, oy = elem["x"], elem["y"] with Image.open(elem["path"]).convert("RGBA") as im: @@ -238,14 +238,19 @@ async def amain() -> None: r, g, b, a = im.getpixel((x, y)) # type: ignore if a < 128: continue - ndx_start = (x + ox + (y + oy) * 250) * 16 - color: int = (r >> 3) << 13 - color |= (g >> 2) << 5 - color |= b >> 3 + + offset: int = (x + ox + (y + oy) * 250) * 16 + + rgb: int = (r >> 3) << 11 + rgb |= (g >> 2) << 5 + rgb |= (b >> 3) + + color: int = (rgb & 0xFF) << 8 + color |= (rgb >> 8) for i in range(16): mgr.put_index( - ndx_start + i, ((color >> i) & 1) > 0 + offset + i, ((color << i) & 0x8000) > 0 ) elif elem["type"] == "rect": for y in range(elem["y"], elem["y"] + elem["h"]): diff --git a/pictures/niko.png b/pictures/niko.png new file mode 100644 index 0000000..5661e6f Binary files /dev/null and b/pictures/niko.png differ diff --git a/settings.json b/settings.json index c96b4e7..7bc47a8 100644 --- a/settings.json +++ b/settings.json @@ -50,12 +50,6 @@ } ], "elements": [ - { - "type": "blob", - "path": "./pictures/bit.txt", - "offset": 16384, - "length": 12632 - }, { "type": "image", "path": "./pictures/kangel.png", @@ -88,11 +82,10 @@ "y": 256 }, { - "type": "animation", - "path": "./pictures/loading.gif", - "x": 436, - "y": 436, - "spf": 10 + "type": "rgb565", + "path": "./pictures/niko.png", + "x": 48, + "y": 12 } ] }