def input(self, key): key = key.replace('control-', '') key = key.replace('shift-', '') key = key.replace('alt-', '') if key in self._input_name_changes: key = self._input_name_changes[key] if key in input_handler.rebinds: key = input_handler.rebinds[key] try: mouse.input(key) except: pass try: input_handler.input(key) except: pass if not application.paused: try: __main__.input(key) except: pass for entity in scene.entities: if entity.enabled == False or entity.ignore or entity.ignore_input: continue if application.paused and entity.ignore_paused == False: continue if hasattr(entity, 'input'): entity.input(key) if hasattr(entity, 'scripts'): for script in entity.scripts: if script.enabled and hasattr(script, 'input'): script.input(key) if key == 'f11': window.fullscreen = not window.fullscreen if key == 'f10': i = window.display_modes.index(window.display_mode) i += 1 if i >= len(window.display_modes): i = 0 window.display_mode = window.display_modes[i] if key == 'f9': window.display_mode = 'default' if key == 'escape': if not application.paused: application.pause() else: application.resume()
def input(self, key): if not isinstance(key, str): if key.repeat: self.input_hold(key.key) return key = key.key # print('------------', key) key = key.lower() if key in self._input_name_changes: key = self._input_name_changes[key] key = key.replace('control-', '') key = key.replace('shift-', '') key = key.replace('alt-', '') if key in input_handler.rebinds: key = input_handler.rebinds[key] try: input_handler.input(key) except: pass if not application.paused: if hasattr(__main__, 'input'): __main__.input(key) for entity in scene.entities: if entity.enabled: if hasattr(entity, 'input'): entity.input(key) if hasattr(entity, 'scripts'): for script in entity.scripts: if hasattr(script, 'input'): script.input(key)