import pygame
from colorsys import hls_to_rgb
from gradients import gradients
+from cursors import WarpingCursor
from math import floor
import types
# TODO : positionner cette constance en fonction de la résolution d'affichage
ON_COLUMN_OVERSIZING = 1.5
-def rename_method(newName) :
+def event_handler(eventType) :
def doRename(m) :
- m.__name__ = newName
+ m.__name__ = 'eventHandler%s' % eventType
return m
return doRename
self.distinctNotes = distinctNotes
self.keyboardLength = 0
self.keyboardRects = []
+ self.cursor = None
self._initRects()
self._initColumns()
self._running = False
+ self.draw(pygame.display.get_surface())
+ self._initCursor()
print hue
c = Column(hue, rect)
self.add(c)
-
+
+ def _initCursor(self) :
+ self.cursor = WarpingCursor()
+ #self.add(self.cursor)
+
def highlightColumn(self, index) :
for i, sprite in enumerate(self.sprites()) :
handler = getattr(self, 'eventHandler%s' % event.type, lambda e:None)
handler(event)
- @rename_method('eventHandler%s' % pygame.KEYDOWN)
+ @event_handler(pygame.KEYDOWN)
def handleKeyDown(self, event) :
if event.key == pygame.K_q:
self._running = False
if uni.isdigit() and int(uni) <=8 :
self.highlightColumn(int(uni))
+
+ @event_handler(pygame.MOUSEMOTION)
+ def handleMouseMotion(self, event) :
+ pass