Back to index

freevial  1.2
Classes | Functions | Variables
common.events Namespace Reference

Classes

class  EventHandle

Functions

def waitForMouseRelease
def pauseGameUntilRestore
def printKey

Variables

dictionary mouseButtons
 aobert = atancatadieresiacircFalse
list accents = [u"aeiou", u"àèìòù", u"áéíóú", u"äëïöü", u"âêîôû" ]

Function Documentation

Definition at line 247 of file events.py.

00247 
00248 def pauseGameUntilRestore( ):
00249        
00250        while True:
00251               for event in pygame.event.get():
00252                      if EventHandle(event).isWindowRestore():
00253                             return False
00254               
00255               # Sleep for 10 milliseconds.
00256               # This has no visible effect but will drastically reduce CPU usage.
00257               pygame.time.wait(10)
00258 

Here is the caller graph for this function:

def common.events.printKey (   tecla)
Translates a pygame Key object for on-game printing of it's value. 

Definition at line 262 of file events.py.

00262 
00263 def printKey( tecla ):
00264        """ Translates a pygame Key object for on-game printing of it's value. """
00265 
00266        global aobert, atancat, adieresi, acirc, accents
00267        
00268        keyname = pygame.key.name(tecla)
00269        
00270        if keyname == 'space': 
00271               return ' '
00272        
00273        if keyname == 'world 71':
00274               return u'ç'
00275        
00276        if keyname == 'tab':
00277               return '    '
00278        
00279        if len(keyname) == 3 and keyname[:1] == '[' and keyname[2:] == ']':
00280               keyname = keyname[1:2]
00281        
00282        pos = accents[0].find( keyname )
00283        if pos != -1:
00284               if aobert: keyname = accents[1][pos]
00285               if atancat: keyname = accents[2][pos]
00286               if adieresi: keyname = accents[3][pos]
00287               if acirc: keyname = accents[4][pos]
00288        
00289        if pygame.key.get_mods() & pygame.KMOD_SHIFT:
00290               keyname = keyname.upper()
00291        
00292        if tecla == 314:
00293               if pygame.key.get_mods() & pygame.KMOD_SHIFT:
00294                      atancat = True
00295               elif pygame.key.get_mods() & pygame.KMOD_CTRL:
00296                      adieresi = True
00297               elif pygame.key.get_mods() & pygame.KMOD_ALT:
00298                      acirc = True
00299               else:
00300                      aobert = True
00301        else:
00302               aobert = atancat = adieresi = acirc = False
00303        
00304        if not re.search(u"^[a-zA-Z0-9,.+'-/*àèìòùáéíóúäëïöüâêîôû ]$", keyname):
00305               return ''
00306        
00307        return keyname

Here is the caller graph for this function:

Definition at line 241 of file events.py.

00241 
00242 def waitForMouseRelease( ):
00243 
00244        while pygame.mouse.get_pressed()[0] + pygame.mouse.get_pressed()[1] + pygame.mouse.get_pressed()[2] != 0:
00245               pygame.event.wait() 
00246 

Here is the caller graph for this function:


Variable Documentation

list common.events.accents = [u"aeiou", u"àèìòù", u"áéíóú", u"äëïöü", u"âêîôû" ]

Definition at line 260 of file events.py.

common.events.aobert = atancatadieresiacircFalse

Definition at line 259 of file events.py.

Initial value:
00001 {
00002               'primary': 1,
00003               'secondary': 2,
00004               'middle': 3,
00005        }

Definition at line 33 of file events.py.