Example #1
0
    def on_key_press(self, window, symbol, modifiers):
        
        """Handles keyboard input. The keys are defined in options.py and are
        sorted according to namespaces. See that file for further information.

        Arguments:
        window -- the window that recieved the keypress
        symbol -- the key that was pressed
        modifiers -- the modifiers (ctrl, alt, etc.) that were down 
                     when the keypress occurred

        """
        
        if symbol == kb.test.exit:
            window.close()
        elif symbol == kb.test.threadtest:
            game_manager.push(SoundTestScene())
        elif symbol == kb.test.tabtest:
            game_manager.push(GameScene("data/pokemon-melody.mid"))
        elif symbol == kb.test.maintest:
            game_manager.push(MainTestScene())
        elif symbol == kb.test.up:
            game_manager.pop()
        else:
            print "Recieved keypress:", symbol, "\t\tModifiers:", modifiers
Example #2
0
 def on_key_press(self, window, symbol, modifiers):
     """Catches keyboard events.
     Returns True if the symbol was handled or False otherwise."""
     if symbol == options.kb.menu.left:
         self.next()
     elif symbol == options.kb.menu.right:
         self.prev()
     elif symbol == options.kb.test.up:
         game_manager.pop()
     elif symbol == options.kb.menu.select:
         self.items[self.selected].select()
Example #3
0
 def on_music_eos():
     self.music._old_eos()
     game_manager.pop()