from colorsys import hls_to_rgb
from gradients import gradients
from cursors import WarpingCursor
-from eventutils import event_handler, EventHandlerMixin
+from eventutils import event_handler, EventDispatcher, EventHandlerMixin
from math import floor
import types
# TODO : positionner cette constance en fonction de la résolution d'affichage
distinctNotes : notes disctinctes présentes dans la chanson
triées du plus grave au plus aigu.
"""
+ print '__init__ _PlayingScreenBase'
super(_PlayingScreenBase, self).__init__()
self.distinctNotes = distinctNotes
self.keyboardLength = 0
hueStep = FIRST_HUE / (self.keyboardLength - 1)
for i, rect in enumerate(self.keyboardRects) :
hue = FIRST_HUE - hueStep * i
- print hue
c = Column(hue, rect)
self.add(c)
def run(self):
self._running = True
+ clock = pygame.time.Clock()
while self._running :
pygame.display.flip()
- events = pygame.event.get()
- for event in events:
- self.input(event)
-
- def input(self, event) :
- handler = getattr(self, 'eventHandler%s' % event.type, lambda e:None)
- handler(event)
+ EventDispatcher.dispatchEvents()
+ clock.tick(50)
@event_handler(pygame.KEYDOWN)
def handleKeyDown(self, event) :
class SongPlayingScreenTest(_PlayingScreenBase) :
def __init__(self) :
+ print '__init__ SongPlayingScreenTest'
class C:pass
o = C()
o.midi=1