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

utils   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 4

2 Functions

Rating   Name   Duplication   Size   Complexity  
A get_text() 0 8 2
A load() 0 3 2
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