mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-24 19:32:33 +00:00
Generalized font compiler
This commit is contained in:
parent
4e2d8eb87b
commit
5f2d128eb3
@ -5,18 +5,18 @@ import PIL
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from numpy import asarray
|
from numpy import asarray
|
||||||
|
|
||||||
CHAR_WIDTH = 8
|
def labelFromCharXY(charFirst, charX, numCharX, charY):
|
||||||
CHAR_HEIGHT = 8
|
|
||||||
CHAR_FIRST = 32
|
|
||||||
CHROMA = 14
|
|
||||||
|
|
||||||
def labelFromCharXY(charX, numCharX, charY):
|
|
||||||
charIndex = charY*numCharX + charX
|
charIndex = charY*numCharX + charX
|
||||||
currChar = chr(charIndex+CHAR_FIRST)
|
currChar = chr(charIndex+charFirst)
|
||||||
return "char{:d}".format(ord(currChar))
|
return "char{:d}".format(ord(currChar))
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
image = Image.open('Art/Assets/Font8x8.gif')
|
CHAR_WIDTH = int(argv[0])
|
||||||
|
CHAR_HEIGHT = int(argv[1])
|
||||||
|
CHAR_FIRST = int(argv[2])
|
||||||
|
CHROMA = int(argv[3])
|
||||||
|
image = Image.open(argv[4])
|
||||||
|
|
||||||
pixels = asarray(image)
|
pixels = asarray(image)
|
||||||
numCharX = (int)(image.size[0]/CHAR_WIDTH)
|
numCharX = (int)(image.size[0]/CHAR_WIDTH)
|
||||||
numCharY = (int)(image.size[1]/CHAR_HEIGHT)
|
numCharY = (int)(image.size[1]/CHAR_HEIGHT)
|
||||||
@ -25,14 +25,14 @@ def main(argv):
|
|||||||
print ("characterJumpTable:")
|
print ("characterJumpTable:")
|
||||||
for charY in range(0,numCharY):
|
for charY in range(0,numCharY):
|
||||||
for charX in range(0,numCharX):
|
for charX in range(0,numCharX):
|
||||||
print ("\t.addr %s" % labelFromCharXY(charX,numCharX,charY))
|
print ("\t.addr %s" % labelFromCharXY(CHAR_FIRST,charX,numCharX,charY))
|
||||||
print ("")
|
print ("")
|
||||||
|
|
||||||
# Generate code for each glyph
|
# Generate code for each glyph
|
||||||
for charY in range(0,numCharY):
|
for charY in range(0,numCharY):
|
||||||
for charX in range(0,numCharX):
|
for charX in range(0,numCharX):
|
||||||
|
|
||||||
print ("%s:\n" % labelFromCharXY(charX,numCharX,charY), end="")
|
print ("%s:\n" % labelFromCharXY(CHAR_FIRST,charX,numCharX,charY), end="")
|
||||||
|
|
||||||
# Header for each rendering operation
|
# Header for each rendering operation
|
||||||
print ("\ttya") # Transfer character VRAM position from Y to stack pointer
|
print ("\ttya") # Transfer character VRAM position from Y to stack pointer
|
||||||
|
2
Makefile
2
Makefile
@ -71,7 +71,7 @@ terrain_e1:
|
|||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
rm -rf $(FONTBANK)
|
rm -rf $(FONTBANK)
|
||||||
./CompileFont.py > font8x8.s
|
./CompileFont.py 8 8 32 14 "Art/Assets/Font8x8.gif" > font8x8.s
|
||||||
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr 0000 -lfonts.lst fontEngine.s -o $(FONTBANK)
|
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr 0000 -lfonts.lst fontEngine.s -o $(FONTBANK)
|
||||||
rm -f fontEngine.o
|
rm -f fontEngine.o
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user