📜  pygame center text in rect - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:27.015000             🧑  作者: Mango

代码示例2
font = pygame.font.Font(None, 25)
text = font.render("You win!", True, BLACK)
text_rect = text.get_rect(center=(SCREEN_WIDTH/2, SCREEN_HEIGHT/2))
screen.blit(text, text_rect)