From: pin Date: Thu, 18 Feb 2010 16:32:40 +0000 (+0000) Subject: héritage OrderedUpdates. X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/commitdiff_plain/c45ad7aa755a1d37d56c49bb8f3f9aba9b51476e?ds=inline héritage OrderedUpdates. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@43 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/app/widgets/playingscreen.py b/src/app/widgets/playingscreen.py index 0e64795..8eeaf79 100755 --- a/src/app/widgets/playingscreen.py +++ b/src/app/widgets/playingscreen.py @@ -20,7 +20,7 @@ ON_TOP_LUMINANCE = 0.6 ON_BOTTOM_LUMINANCE = 0.9 ON_SATURATION = 1 -class _PlayingScreenBase(pygame.sprite.Group) : +class _PlayingScreenBase(pygame.sprite.OrderedUpdates) : def __init__(self, distinctNotes=[]) : """ distinctNotes : notes disctinctes présentes dans la chanson @@ -69,13 +69,11 @@ class _PlayingScreenBase(pygame.sprite.Group) : c = Column(hue, rect) self.add(c) - - def drawColumns(self) : - pass - + def highlightColumn(self, index) : for i, sprite in enumerate(self.sprites()) : sprite.update(i==index) + self.draw(pygame.display.get_surface()) @@ -92,12 +90,15 @@ class SongPlayingScreenTest(_PlayingScreenBase) : o.midi=1 super(SongPlayingScreenTest, self).__init__([o]) self.__running = True - pygame.display.flip() - #while self.__running : - # events = pygame.event.get() - # for event in events: - # self.input(event) - # pygame.display.flip() + #pygame.display.flip() + #raw_input('allez ?') + + def run(self): + while self.__running : + pygame.display.flip() + events = pygame.event.get() + for event in events: + self.input(event) def input(self, event) : if event.type == pygame.KEYDOWN: @@ -141,9 +142,9 @@ class Column(pygame.sprite.Sprite) : topRgba = hls_to_rgba_8bits(hue, ON_TOP_LUMINANCE, ON_SATURATION) bottomRgba = hls_to_rgba_8bits(hue, ON_BOTTOM_LUMINANCE, ON_SATURATION) size = rect.inflate(2*rect.width,0).size - self.stateOn = gradients.vertical(rect.size, topRgba, bottomRgba) + self.stateOn = gradients.vertical(size, topRgba, bottomRgba) - self.image = self.stateOn + self.image = self.stateOff self.rect = rect def update(self, state) :