From 7c6894614dcc3ebc5d4c8839b64f4da761b5ccf0 Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 2 Feb 2023 01:02:03 -0800 Subject: Begin work adding emotes Done: * Users can add images to Fonts/Emotes/ * The basename of that image ('clueless.png' becomes 'clueless') is the keyword to make the image show up in game. * Fix a bug in the shader where letters on the 2nd texture and later would have UV outside of [0.0, 1.0] Not yet implemented: * transcribed words are encoded using emotes mapping --- Scripts/emotes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Scripts/emotes.py') diff --git a/Scripts/emotes.py b/Scripts/emotes.py index 0a4ed01..6ae0930 100644 --- a/Scripts/emotes.py +++ b/Scripts/emotes.py @@ -111,16 +111,28 @@ def addImageToTexture(tex: Image, img_path: str, x: int, y:int): def parseArgs(): parser = argparse.ArgumentParser() parser.add_argument("--texture_path", type=str, help="Path to save the generated texture.") + parser.add_argument("--rows", type=str, help="The number of rows on the board") + parser.add_argument("--cols", type=str, help="The number of columns on the board") args = parser.parse_args() - if not args.texture_path: - args.texture_path = "img_texture.png" + if not args.texture_path or not args.rows or not args.cols: + print("--texture_path, --rows, --cols required", file=sys.stderr) + sys.exit(1) return args if __name__ == "__main__": args = parseArgs() + rows = int(args.rows) + cols = int(args.cols) + # board is this much wider than tall + board_aspect_ratio = 2 + # each cell a square divided into `rows`x`cols` is this much wider than tall + cell_aspect_ratio = rows / cols + # each cell is this much wider than tall + board_cell_aspect_ratio = board_aspect_ratio * cell_aspect_ratio + tex = openTexture(args.texture_path) for i in range(0, len(IMG_TEX_DATA)): filename = IMG_TEX_DATA[i][0] -- cgit v1.2.3