Add makeDoubleSidedFace function

This commit is contained in:
Adam Goldsmith 2017-08-05 13:55:43 -04:00
parent a2fa5f7bce
commit 5f102abeca

View File

@ -77,6 +77,11 @@ def makeFace(baseImage, baseX, cardNum, deckType, cardFile, card):
fig = makeSVG(path, card)
addCardToBase(fig, baseImage, baseX, cardNum)
def makeDoubleSidedFace(baseImage, baseX, cardNum, deckType, cardFile,
cardFront, cardBack):
makeFace(baseImage, baseX, cardNum, deckType, cardFile, cardFront)
makeFace(baseImage, baseX, cardNum + 1, deckType, cardFile, cardBack)
def makeFaces(deckJson, outfile):
baseX = math.ceil(math.sqrt(len(deckJson['deck']) + len(deckJson['character']) * 2))
baseImage = etree.ElementTree(
@ -103,15 +108,13 @@ def makeFaces(deckJson, outfile):
front["name"] = card["name"]
back = card["back"]
back["name"] = card["name"]
makeFace(baseImage, baseX, cardNum, deckType, "character.svg", front)
cardNum += 1
makeFace(baseImage, baseX, cardNum, deckType, "character.svg", back)
cardNum += 1
makeDoubleSidedFace(baseImage, baseX, cardNum, deckType,
"character.svg", front, back)
cardNum += 2
makeFace(baseImage, baseX, cardNum, deckType, "instructions.svg", front)
cardNum += 1
makeFace(baseImage, baseX, cardNum, deckType, "instructions.svg", back)
cardNum += 1
makeDoubleSidedFace(baseImage, baseX, cardNum, deckType,
"instructions.svg", front, back)
cardNum += 2
# Make a card for each card