Button.py 文件源码

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

项目:Boardgame 作者: RensMo 项目源码 文件源码
def draw(self, surface):
        mouse = pygame.mouse.get_pressed()
        self.sound = Sound1

        if not self.rect.collidepoint(pygame.mouse.get_pos()):
            surface.blit(self.I, (self.rect))
        elif self.rect.collidepoint(pygame.mouse.get_pos()):
            if mouse[0]:
                self.sound.play()
            self.I = pygame.transform.scale(self.I, (int(self.sx * 1.02), int(self.sy * 1.02)))
            self.rect = pygame.Rect((int(self.x - (self.sx * 1.02 - self.sx)), int(self.y - (self.sy * 1.02 - self.sy))), (int(self.sx), int(self.sy)))
            self.srect = pygame.Surface((int(self.sx * 1.02), int(self.sy * 1.04)))
            self.srect.fill(pygame.Color("Black"))
            self.srect.set_alpha(68)
            surface.blit(self.srect, (int(self.x), int(self.y)))
            surface.blit(self.I, (self.rect))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号