summaryrefslogtreecommitdiff
path: root/src/sliceitoff/images/images.py
blob: b2d93a268642751e3bcb2f29f6585beb84704d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import pygame

from display import Scaling

DEBUG = os.getenv("DEBUG")

images = {}

def load_images():
    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),
                        Scaling.factor)