Passed
Push — master ( 2f29cd...4bc53c )
by Yohann
01:12
created

utils.load()   A

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
import pygame
2
3
4
def load(path, alpha=True):
5
    return pygame.image.load(path).convert_alpha() \
6
        if alpha else pygame.image.load(path).convert()
7
8
9
def get_text(text, font, c, pos, centered=False):
10
    text = font.render(text, True, c, None)
11
    text_rect = text.get_rect()
12
    if centered:
13
        text_rect.center = pos
14
    else:
15
        text_rect.x, text_rect.y = pos
16
    return text, text_rect
17