📜  如何在pygame中不按住鼠标 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:22.290000             🧑  作者: Mango

代码示例1
class Button(object):
    def __init__(self,x,y,width,height,color):
        self.rect = pygame.Rect(x,y,width,height)
        self.image=pygame.draw.rect(screen, color,(self.rect),)
        self.x=x
        self.y=y
        self.width=width
        self.height=height

    def check(self):
        return self.rect.collidepoint(pygame.mouse.get_pos())