gamemenu.py 文件源码

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

项目:solarwolf 作者: pygame 项目源码 文件源码
def renderhall(self):
        winners = [w for w in players.winners if w.name]
        if not winners:
            return None

        textfont = txt.Font(None, 24)
        smallfont = txt.Font(None, 16)
        count = min(4, len(players.winners))
        size = count*160, 70
        img = pygame.Surface(size)
        img.fill((30,30,80))
        pygame.draw.rect(img, (50, 50, 100), img.get_rect(), 1)
        img.blit(fame, (8, 3))

        left = 90
        firstone = 1
        for p in winners:
            if not firstone:
                pygame.draw.line(img, (50, 50, 100), (left-80, 20), (left-80, 60), 1)
            img.blit(*textfont.text((240, 240, 240), p.name, (left, 40)))
            if p.cheater:
                img.blit(*smallfont.text((160, 160, 160), 'Cheater', (left, 58)))
            elif p.lives:
                if p.skips:
                    img.blit(*smallfont.text((160, 160, 160), '%d ships, %d skips'%(p.lives,p.skips), (left, 58)))
                else:
                    img.blit(*smallfont.text((160, 160, 160), '%d ships'%p.lives, (left, 58)))
            left += 160
            firstone = 0

        return img, Rect((gfx.rect.width-size[0]-10, 520), size)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号