diff options
Diffstat (limited to 'src/sliceitoff/images/images.py')
-rw-r--r-- | src/sliceitoff/images/images.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sliceitoff/images/images.py b/src/sliceitoff/images/images.py new file mode 100644 index 0000000..102ca0f --- /dev/null +++ b/src/sliceitoff/images/images.py @@ -0,0 +1,19 @@ +import os +import pygame + +DEBUG = os.getenv("DEBUG") + +images = {} + +def load_images(scale): + if not images: + with open("assets/images.lst") as image_list_file: + for line in image_list_file: + name, *path = line.strip().split() + filename = os.path.join(*path) + if DEBUG: + print(f"Loading images {name = }, {filename = }") + image = pygame.image.load(filename) + images[name] = pygame.transform.smoothscale_by( + pygame.Surface.convert_alpha(image), + scale) |