aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_map_img.py10
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]