diff options
| author | yum <yum.food.vr@gmail.com> | 2023-02-02 01:02:03 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-02-13 14:36:20 -0800 |
| commit | 7c6894614dcc3ebc5d4c8839b64f4da761b5ccf0 (patch) | |
| tree | 6232b86b09190fd162aeb67229da359971b2e517 /Scripts/emotes.py | |
| parent | 2fc3b1b978b6e24814e9de7200865b912108bd34 (diff) | |
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
Diffstat (limited to 'Scripts/emotes.py')
| -rw-r--r-- | Scripts/emotes.py | 16 |
1 files changed, 14 insertions, 2 deletions
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] |
