我正在和我的朋友一起使用pygame开发Python项目。我们试图在游戏中显示FPS,但是我们总是失败。FPS计数器始终为零。以下是代码:
#Create Text
def Render_Text(what, color, where):
font = pygame.font.Font('assets/Roboto.ttf', 30)
text = font.render(what, 1, pygame.Color(color))
window.blit(text, where)
#Show FPS
Render_Text(str(int(clock.get_fps())), (255,0,0), (0,0))
print("FPS:", int(clock.get_fps()))
clock
=pygame.time.Clock()
吗? - CopyrightCclock.tick()
吗? - Rabbid76