Exemple #1
0
 def __init__(self):
     self.keymap_on_press = {}
     self.keymap_on_release = {}
     self.KEY_REPEAT_EVENT = generate_next_event_id()      
     self.pressed_keys = []
     self.keys_timeout = {}  
     event_handler(pygame.KEYDOWN, self.__keymap_event_handler)
     event_handler(pygame.KEYUP, self.__keymap_event_handler)
     event_handler(self.KEY_REPEAT_EVENT, self.__key_repeat_event_handler)
Exemple #2
0
    def __init__(self):
        global main_window
        global surfaces

        self.SCREEN_UPDATE = generate_next_event_id()
        self.surfaces = []
        self.main_window = pygame.display.set_mode((800, 600), pygame.HWSURFACE)
        pygame.time.set_timer(self.SCREEN_UPDATE, 1000 / FIX_FPS)
        event_handler(self.SCREEN_UPDATE, self.redraw)
        event_handler(pygame.QUIT, lambda (event): sys.exit(0))

        self.clock = Clock()