-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
40 lines (32 loc) · 976 Bytes
/
debug.py
File metadata and controls
40 lines (32 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pygame
# pygame.init()
# screen = pygame.display.get_surface()
log_true = False
debug_true = False
log_level = 0
def setup(screen_, log_bool):
screen = screen_
screen = screen_
print("Log:", log_true)
print("Debug info:", debug_true)
# log_true = log_bool
font = pygame.font.Font('fonts/CaskaydiaCoveNerdFont-Regular.ttf', 20)
debug_list = []
def log(text, end=None, level=0):
if log_true:
if level <= log_level:
for i in range(level): print("\t", end='')
text = str(text)
print("Log:", text, end=end)
def debug(text):
text_surf = font.render(str(text), True, (255,255,255))
text_rect = text_surf.get_rect()
# screen.blit(text_surf, text_rect)
debug_list.append([text_surf, text_rect])
def print_debug():
if debug_true:
for i, m in enumerate(debug_list):
m[1].x = 0
m[1].y = i * 30
screen.blit(m[0], m[1])
debug_list.clear()