def input_keyboard(self): # doesn't do keyboard loop if there is no key input # only continues if their is a keypressed if self.key.vk != 0: if self.key.vk == ltc.KEY_ENTER and key.lalt: ltc.console_set_fullscreen(not ltc.console_set_fullscreen) elif self.key.vk == ltc.KEY_ESCAPE: self.exit() self.cursor.input_keyboard(self.key) # pass through to the characters for index,character in enumerate(self.characters): character.keypressed(self.key)
def handle_keys(player, map): if network.multiplayer: key = tcod.console_check_for_keypress(True) # Realtime else: key = tcod.console_wait_for_keypress(True) # Turnbased if key.vk is tcod.KEY_ENTER and key.lalt: # Alt+Enter to toggle fullscreen tcod.console_set_fullscreen(not tcod.console_is_fullscreen()) elif key.vk is tcod.KEY_ESCAPE: return True # Exit! # Movement! if tcod.console_is_key_pressed(tcod.KEY_UP): player.move(0, -1, map) if tcod.console_is_key_pressed(tcod.KEY_DOWN): player.move(0, 1, map) if tcod.console_is_key_pressed(tcod.KEY_LEFT): player.move(-1, 0, map) if tcod.console_is_key_pressed(tcod.KEY_RIGHT): player.move(1, 0, map)