summaryrefslogtreecommitdiff
path: root/src/sliceitoff/images/images.py
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-16 11:11:56 +0200
committerViljami Ilola <+@hix.fi>2024-03-16 11:11:56 +0200
commit85adc89f53763b4390f7e51161a05ab394143152 (patch)
treeb63de708a75d7ea3fd961f8d63ca2af381cb66c5 /src/sliceitoff/images/images.py
parent5d921239e0577988e2b7814025149d9160ecbdda (diff)
drafting game components
Diffstat (limited to 'src/sliceitoff/images/images.py')
-rw-r--r--src/sliceitoff/images/images.py19
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)