我有一个名为“pixelfont”的字体,希望能加载到我的游戏中。怎样才能将这种字体加载到pygame中呢?我已经尝试了以下方法:
import pygame
font_1_path = pygame.font.match_font("pixelfont", 0, 0)
font_1 = pygame.font.Font(font_1_path, 128)
text = font.render("Hello world!", True, (0, 0, 0))
display.blit(text, [0, 0])
为什么这段代码没有以像素字体输出“Hello world!”?
pygame.font.Font("pixelfont.ttf", 128)
简单地加载它(假设 pixelfont.ttf 在当前工作目录中)。 - Spooky