diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2021-01-02 22:22:09 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2021-01-02 22:23:46 +0100 |
| commit | 63767a954c71b05ac529679fa5160bb7d6f05636 (patch) | |
| tree | cd4abae83c1421864565e02e9c148575b0203742 /scripts | |
| parent | 701bb96d962b1051a42ff432185f9e300a8d4bb7 (diff) | |
| download | muhqs-game-63767a954c71b05ac529679fa5160bb7d6f05636.tar.gz muhqs-game-63767a954c71b05ac529679fa5160bb7d6f05636.zip | |
add map Makefile and don't show generated maps by default
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/generate_map_img.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/generate_map_img.py b/scripts/generate_map_img.py index 608c1fe6..bb6925bc 100755 --- a/scripts/generate_map_img.py +++ b/scripts/generate_map_img.py @@ -8,6 +8,7 @@ from typing import MutableMapping MAP_ROOT = pathlib.Path(os.getcwd()) TILES_DIR = MAP_ROOT / 'tiles' +SHOW_MAP = False def get_tile_path(tile: str) -> pathlib.Path: """Return the corresponding image file name for a tile""" @@ -111,8 +112,9 @@ def generate_img(map_path: pathlib.Path): rows_imgs.append(row_img) map_img = cv2.vconcat(rows_imgs) - cv2.imshow(f'{map_path.stem}.png', map_img) - cv2.waitKey(0) + if SHOW_MAP: + cv2.imshow(f'{map_path.stem}.png', map_img) + cv2.waitKey(0) cv2.imwrite(f'{map_path.stem}.png', map_img) def main(): @@ -121,6 +123,7 @@ def main(): parser = argparse.ArgumentParser(description='generate latex standalone cards') parser.add_argument('map_input', help='map file or directory containing map files') parser.add_argument('--map-root', help='path to the map root directory') + parser.add_argument('--show-map', help='show the generated map', action='store_true') args = parser.parse_args() @@ -130,6 +133,9 @@ def main(): global TILES_DIR TILES_DIR = MAP_ROOT / 'tiles' + if args.show_map: + global SHOW_MAP + SHOW_MAP = True map_path = pathlib.Path(args.map_input) map_files = [map_path] |
