pygame_functions.py 文件源码

python
阅读 61 收藏 0 点赞 0 评论 0

项目:Pygame_Functions 作者: StevePaget 项目源码 文件源码
def __init__(self, text, fontSize, font, fontColour, xpos, ypos, background):
        pygame.sprite.Sprite.__init__(self)
        self.fontColour = pygame.Color(fontColour)
        self.fontFace = pygame.font.match_font(font)
        self.fontSize = fontSize
        self.background = background
        self.font = pygame.font.Font(self.fontFace, self.fontSize)
        newSurface = self.font.render(text, True, self.fontColour)
        self.rect = newSurface.get_rect()
        if self.background != "clear":
            self.image = pygame.Surface((self.rect.width, self.rect.height))
            self.image.fill(pygame.Color(background))
            self.image.blit(newSurface, [0, 0])
        else:
            self.image = newSurface
        self.rect.topleft = [xpos, ypos]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号