utils.load_texture()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nop 2
1
import pygame
2
3
TEXTURES_PATH: str = "assets/textures"
4
5
6
def load_texture(file: str, alpha: bool = True) -> pygame.Surface:
7
    """Loads a asset from a file and convert it into a pygame.Surface."""
8
    surface = pygame.image.load(f'{TEXTURES_PATH}/{file}')
9
    return surface.convert_alpha() if alpha else surface.convert()
10