summaryrefslogtreecommitdiff
path: root/src/sliceitoff/images/images.py
blob: 102ca0fc1b4861d676c5958a3663b4fcc75e885a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)