def mouseMove(self, mousePoint):
     mousePoint = mousePoint[0]-self.x, mousePoint[1]-self.y
     if util.pointInside(mousePoint, self.leftTri):
         self.highlight = 0
     elif util.pointInside(mousePoint, self.rightTri):
         self.highlight = 1
     elif util.pointInside(mousePoint, self.getPoints(self.selectRect)):
         self.highlight = 2
     else:
         self.highlight = -1
 def mouseMove(self, mousePoint):
     mousePoint = mousePoint[0] - self.x, mousePoint[1] - self.y
     if util.pointInside(mousePoint, self.getPoints(self.closeRect)):
         self.highlight = 0
     elif util.pointInside(mousePoint, self.getPoints(self.leaveRect)) and self.leaveGame:
         self.highlight = 1
     elif util.pointInside(mousePoint, self.getPoints(self.changeRect)) and self.changeChar:
         self.highlight = 2
     elif util.pointInside(mousePoint, self.getPoints(self.quitRect)):
         self.highlight = 3
     else:
         self.highlight = -1
示例#3
0
 def processEvents(self, events):
     for event in events:
         if event.type == pygame.MOUSEBUTTONDOWN:
             if event.button == 1:
                 if util.pointInside((event.pos[0], event.pos[1]), self.getPoints()):
                     if self.onClick != None: self.onClick()
         elif event.type == pygame.MOUSEMOTION:
             if util.pointInside((event.pos[0], event.pos[1]), self.getPoints()) and self.overImg != None:
                 self.activeImg = self.overImg
                 self.change = True
             else:
                 if self.change:
                     self.activeImg = self.mainImg
                     self.change = False
 def processEvents(self, events):
     for event in events:
         if event.type == pygame.MOUSEBUTTONDOWN:
             if event.button == 1:
                 self.hasFocus = util.pointInside((event.pos[0], event.pos[1]), self.getPoints())
         elif event.type == pygame.KEYDOWN:
             if event.key in (pygame.K_LSHIFT, pygame.K_RSHIFT): self.shiftDown = (event.key == pygame.K_LSHIFT or self.shiftDown[0], event.key == pygame.K_RSHIFT or self.shiftDown[1])
             elif event.key == pygame.K_BACKSPACE and self.hasFocus: self.buffer = self.buffer[0:-1]
             elif event.key == pygame.K_RETURN:
                 if self.onEnter != None: self.onEnter()
             elif event.key <= 127 and self.hasFocus:
                 c = chr(event.key)
                 if True in self.shiftDown:
                     if c in self.lowerNum:
                         c = self.upperNum[self.lowerNum.index(c)]
                     else:c = c.upper()
                 self.buffer += c
         elif event.type == pygame.KEYUP:
             if event.key == pygame.K_LSHIFT:
                 self.shiftDown = (False, self.shiftDown[1])
             elif event.key == pygame.K_RSHIFT:
                 self.shiftDown = (self.shiftDown[0], False)
 def mouseMove(self, mousePoint):
     mousePoint = mousePoint[0]-self.x, mousePoint[1]-self.y
     self.highlight = util.pointInside(mousePoint, self.getPoints(self.createRect))
示例#6
0
 def processEvents(self, events):
     for event in events:
         if event.type == pygame.MOUSEBUTTONDOWN:
             if event.button == 1:
                 if util.pointInside((event.pos[0], event.pos[1]), self.getPoints()):
                     self.selectItem(event.pos)