def main(): global render_counter render_counter = 16 window.init() events.init() events.event_handler(events.QUIT, lambda (event): sys.exit(0)) events.event_handler(events.KEYDOWN, __render_symbols) events.run()
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()
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)