render.py 文件源码

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

项目:project_xcape 作者: OthmanEmpire 项目源码 文件源码
def __init__(self, text, size, colour, x, y, screen, isItalic=False):
        """
        :param text: String, the text to render.
        :param size: Integer, the size of the font.
        :param colour: String, the name of the colour to be used.
        :param x: Integer, the x-position of the text.
        :param y: Integer, the y-position of the text.
        :param screen: pygame.Surface, representing the screen.
        :param isItalic: Boolean, whether the text is italics.
        """
        font = pg.font.SysFont(settings.FONT, size)
        font.set_italic(isItalic)
        image = font.render(text, True, settings.COLOURS[colour])
        self.render = RenderComponent(self)
        self.render.add("background", image)
        self.render.state = "background"

        self.text = text
        self.rect = pg.Rect(x, y, 0, 0)
        self.screen = screen
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号