png_to_nbpp*: add support for concatenating multiple files

This commit is contained in:
Zack Buhman 2023-07-29 03:55:51 +00:00
parent d12e49aa16
commit a443d09b3d
3 changed files with 20 additions and 18 deletions

View File

@ -54,11 +54,11 @@ gen/%.cpp: gen/%.hpp $(GEN_PYTHON_SOURCE)
res/%.2bpp: pokered/%.png
@mkdir -p $(dir $@)
python tools/png_to_nbpp.py $< 2 $@
python tools/png_to_nbpp.py 2 $@ $<
res/gfx/sprites/%.2bpp: pokered/gfx/sprites/%.png
@mkdir -p $(dir $@)
python tools/png_to_nbpp_sprite.py $< 2 $@
python tools/png_to_nbpp_sprite.py 2 $@ $<
%.2bpp.h:
$(BUILD_BINARY_H)

View File

@ -47,13 +47,14 @@ def debug(buf, bpp):
if (row % 8 == 7):
print()
in_path = sys.argv[1]
bpp = int(sys.argv[2])
out_path = sys.argv[3]
bpp = int(sys.argv[1])
out_path = sys.argv[2]
assert len(sys.argv) >= 4, sys.argv
im = Image.open(in_path)
buf = convert(im, bpp)
if 'NBPP_DEBUG' in os.environ:
debug(buf, bpp)
with open(out_path, 'wb') as f:
for in_path in sys.argv[3:]:
im = Image.open(in_path)
buf = convert(im, bpp)
if 'NBPP_DEBUG' in os.environ:
debug(buf, bpp)
f.write(buf)

View File

@ -56,13 +56,14 @@ def debug(buf, bpp):
if (row % cell_height == (cell_height - 1)):
print()
in_path = sys.argv[1]
bpp = int(sys.argv[2])
out_path = sys.argv[3]
bpp = int(sys.argv[1])
out_path = sys.argv[2]
assert len(sys.argv) >= 4, sys.argv
im = Image.open(in_path)
buf = convert(im, bpp)
if 'NBPP_DEBUG' in os.environ:
debug(buf, bpp)
with open(out_path, 'wb') as f:
for in_path in sys.argv[3:]:
im = Image.open(in_path)
buf = convert(im, bpp)
if 'NBPP_DEBUG' in os.environ:
debug(buf, bpp)
f.write(buf)