Bläddra i källkod

Use Vogtinator's ConvertImg

Dan ELKOUBY 11 år sedan
förälder
incheckning
f7b23983a1
3 ändrade filer med 3 tillägg och 32 borttagningar
  1. 1 1
      README.md
  2. 2 1
      art/Makefile
  3. 0 30
      art/sprite.py

+ 1 - 1
README.md

@@ -4,5 +4,5 @@ A Pokémon clone for the TI-Nspire. There's still a lot of work before anything
 
 ## Compiling
 
-The build system currently depends on [makeheaders](http://www.hwaci.com/sw/mkhdr/), Python 3 and the Pillow library as well as GNU Make and the Ndless toolchain.
+The build system currently depends on [makeheaders](http://www.hwaci.com/sw/mkhdr/), Vogtinator's [ConvertImg](https://github.com/Vogtinator/ConvertImg), as well as GNU Make and the Ndless toolchain.
 

+ 2 - 1
art/Makefile

@@ -2,7 +2,8 @@ SPRITES = $(wildcard *.png)
 
 all:
 	rm -f sprites.c
-	for FILE in $(SPRITES); do exec ./sprite.py $$FILE >> sprites.c; done
+	echo "#include <os.h>" > sprites.c
+	for FILE in $(SPRITES); do ConvertImg --format n2dlib $$FILE >> sprites.c; done
 
 clean:
 	rm -f sprites.c sprites.h

+ 0 - 30
art/sprite.py

@@ -1,30 +0,0 @@
-#!/usr/bin/env python3
-
-import sys, getopt, os
-from PIL import Image
-
-def getvalue(i, im):
-    r, g, b = im[i]
-    color = (int(r * 31 / 255) << 11) + (int(g * 63 / 255) << 5) + (int(b * 31 / 255))
-    return "0x" + format(color, "04X")
-
-file = sys.argv[1]
-
-im = Image.open(file)
-width, height = im.size
-im = list(im.convert("RGB").getdata())
-sprite = "unsigned short " + os.path.splitext(file)[0] + "[] =\n{\n"
-sprite += "\t" + str(width) + ", " + str(height) + ", "
-sprite += getvalue(0, im)
-sprite += ",\n\t"
-for i in range(width * height):
-    sprite += getvalue(i, im)
-    if i != width * height - 1:
-        if (i + 1) % 10 == 0:
-            sprite += ",\n\t"
-        else:
-            sprite += ", "
-sprite += "\n};"
-
-print(sprite)
-