- def blit(self,surface):
- '''
- Draw the circle on surface
- '''
-
- newPos = (self.centerPosition[0] - self.image.get_width() / 2, self.centerPosition[1] - self.image.get_height() / 2)
- surface.blit(self.image, newPos)
+ @event_handler(TIMEOUT)
+ def loadNext(self, event) :
+ if self._blinking :
+ self.dirty = 1
+ self.image = self.iterator.next()
+
+ @event_handler(pygame.MOUSEBUTTONDOWN)
+ def flashOn(self, event) :
+ self.dirty = 1
+ self._blinking = False
+ self.image = self.flashImage
+
+ @event_handler(pygame.MOUSEBUTTONUP)
+ def flashOff(self, event) :
+ self.dirty = 1
+ if self.blinkMode :
+ self._blinking = True
+ self.loadNext(event)
+ else :
+ self.image = self.images[0]
+
+ @event_handler(pygame.MOUSEMOTION)
+ def move(self, event) :
+ self.dirty = 1
+ self.rect.move_ip(event.rel)
+
+ def setPosition(self, pos) :
+ self.dirty = 1
+ x, y = pos
+ rx, ry = self.rect.centerx, self.rect.centery
+ self.rect.move_ip(x-rx, y-ry)