import pygame
from sys import modules
import pygame
from sys import modules
-events = ['TIMEOUT', 'NOTEON', 'NOTEOFF', 'NOTEEND', 'COLDOWN', 'COLUP', 'COLOVER']
+events = ['TIMEOUT',
+ 'NOTEON',
+ 'NOTEOFF',
+ 'NOTEEND',
+ 'COLDOWN',
+ 'COLUP',
+ 'COLOVER',
+ 'COLSTATECHANGE']
+
eventNames = {}
self = modules[__name__]
eventNames = {}
self = modules[__name__]
events = pygame.event.get()
for event in events :
listeners = self.registry.get(event.type, {})
events = pygame.event.get()
for event in events :
listeners = self.registry.get(event.type, {})
- if listeners and not hiddenEvents.has_key(event.type) :
+ if not hiddenEvents.has_key(event.type):
+ #if listeners and not hiddenEvents.has_key(event.type) :
eventLog.info(pprinters[event.type](event))
for listener in listeners.keys() :
listener(event)
eventLog.info(pprinters[event.type](event))
for listener in listeners.keys() :
listener(event)
from config import ON_COLUMN_ALPHA
from config import LYRICS_FONT, NOTES_FONT
from config import FONT_COLOR
from config import ON_COLUMN_ALPHA
from config import LYRICS_FONT, NOTES_FONT
from config import FONT_COLOR
class Column(pygame.sprite.DirtySprite) :
class Column(pygame.sprite.DirtySprite) :
group.change_layer(self, BACKGROUND_LAYER)
self.image = self.surOff
self.rect = self.rectOff
group.change_layer(self, BACKGROUND_LAYER)
self.image = self.surOff
self.rect = self.rectOff
self.state = state
self.dirty = 1
self.state = state
self.dirty = 1
+ evt = pygame.event.Event(events.COLSTATECHANGE, col=self, state=state, syllabus=syllabus)
+ pygame.event.post(evt)
# parce qu'il s'agit du curseur
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos):
# parce qu'il s'agit du curseur
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos):
+ self.raiseColDown(col, event.pos)
break
@event_handler(pygame.MOUSEBUTTONUP)
def onMouseUp(self, event) :
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos) :
break
@event_handler(pygame.MOUSEBUTTONUP)
def onMouseUp(self, event) :
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos) :
+ self.raiseColUp(col, event.pos)
break
@event_handler(pygame.MOUSEMOTION)
def onMouseMove(self, event) :
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos) :
break
@event_handler(pygame.MOUSEMOTION)
def onMouseMove(self, event) :
for col in reversed(self.sprites()[:-1]) :
if col.rect.collidepoint(*event.pos) :
+ self.raiseColOver(col, event.pos)
- def raiseColDown(self, col) :
- evt = pygame.event.Event(events.COLDOWN, column=col)
+ def raiseColDown(self, col, pos) :
+ evt = pygame.event.Event(events.COLDOWN, column=col, pos=pos)
- def raiseColUp(self, col) :
- evt = pygame.event.Event(events.COLUP, column=col)
+ def raiseColUp(self, col, pos) :
+ evt = pygame.event.Event(events.COLUP, column=col, pos=pos)
- def raiseColOver(self, col) :
- evt = pygame.event.Event(events.COLOVER, column=col)
+ def raiseColOver(self, col, pos) :
+ evt = pygame.event.Event(events.COLOVER, column=col, pos=pos)