def update_input(self): scrolled = False if Input.was_pressed(M_4): scrolled = self.scroll_up() elif Input.was_pressed(M_5): scrolled = self.scroll_down() if scrolled: pos = Input.mouse_pos self.menu.reposition_cursor(pos)
def __update_input(self): for key in game_config.key_cancel: if Input.was_pressed(key) is not None: self.do_cancel = True return for key in game_config.key_action: if Input.was_pressed(key) is not None: self.do_action = True return if self.party_avatar.scheduled_movement \ or self.party_avatar.movement_phase \ or self.message_queue.is_busy(): return if self.do_cancel: self.do_cancel = False get_context_stack().stop() return if self.do_action: self.do_action = False self.map_model.party_action() return for key in game_config.key_up: if Input.motion(key): self.party_avatar.schedule_movement(Step(UP)) return for key in game_config.key_down: if Input.motion(key): self.party_avatar.schedule_movement(Step(DOWN)) return for key in game_config.key_left: if Input.motion(key): self.party_avatar.schedule_movement(Step(LEFT)) return for key in game_config.key_right: if Input.motion(key): self.party_avatar.schedule_movement(Step(RIGHT)) return if game_config.map_mouse_enabled: evt = Input.was_pressed(M_1) if evt is not None: if not self.party_avatar.scheduled_movement: self.__mouse_movement(evt.pos) return
def update(self): for key, command in self.mapping.iteritems(): if Input.was_pressed(key) is not None: if hasattr(command, '__getitem__'): return command[0](*command[1:]) else: return command()
def __update_input(self): #print '__update_input' for key in game_config.key_cancel: if Input.was_pressed(key) is not None: self.menu.close() self.command_cooldown = MenuController.COMMAND_COOLDOWN return for key in game_config.key_action: if Input.was_pressed(key) is not None: self.activate() self.command_cooldown = MenuController.COMMAND_COOLDOWN return if self.menu.cursor is None: return for key in game_config.key_up: if Input.motion(key): self.step(UP) self.command_cooldown = MenuController.COMMAND_COOLDOWN return for key in game_config.key_down: if Input.motion(key): self.step(DOWN) self.command_cooldown = MenuController.COMMAND_COOLDOWN return for key in game_config.key_left: if Input.motion(key): self.step(LEFT) self.command_cooldown = MenuController.COMMAND_COOLDOWN return for key in game_config.key_right: if Input.motion(key): self.step(RIGHT) self.command_cooldown = MenuController.COMMAND_COOLDOWN return self.__update_mouse_input()
def __update_mouse_input(self): evt = Input.was_pressed(M_1) if evt is not None: if self.menu.cursor is not None: w = self.menu.cursor.widget if w is not None: x, y = evt.pos widget_x, widget_y = w.get_menu_position() captured = w.left_click(x - widget_x, y - widget_y) if not captured: self.activate() evt = Input.was_pressed(M_3) if evt is not None: if self.menu.cursor is not None: w = self.menu.cursor.widget if w is not None: x, y = evt.pos widget_x, widget_y = w.get_menu_position() captured = w.right_click(x - widget_x, y - widget_y) self.__update_mouse_motion()
def update_input(self): for key in m_cfg.key_left.union(m_cfg.key_right): Input.was_pressed(key)
def update_input(self): if Input.was_pressed(M_1): self.close()
def update_input(self): for k in game_config.key_cancel: Input.was_pressed(k)
def update_input(self): if Input.was_pressed(M_1): self.activate()
def update_input(self): if Input.was_pressed(M_1) or Input.was_pressed(M_4): self.add_line() if Input.was_pressed(M_3) or Input.was_pressed(M_5): self.remove_line()
def update_input(self): if Input.was_pressed(M_1) or Input.was_pressed(M_4): self.filled += 0.05 if Input.was_pressed(M_3) or Input.was_pressed(M_5): self.filled -= 0.05