X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/a111b5a9b605b9c5c40933c5a8d5b3a5b42a03ae..c45ad7aa755a1d37d56c49bb8f3f9aba9b51476e:/src/app/widgets/playingscreen.py 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) :