Python pyglet.window.key.M Examples
The following are 3
code examples of pyglet.window.key.M().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyglet.window.key
, or try the search function
.
Example #1
Source File: WINDOW_MULTISAMPLE.py From flappy-bird-py with GNU General Public License v2.0 | 6 votes |
def on_key_press(self, symbol, modifiers): mod = 1 if modifiers & key.MOD_SHIFT: mod = -1 if symbol == key.M: self.multisample = not self.multisample self.set_window() if symbol == key.S: self.samples += 2 * mod self.samples = max(2, self.samples) self.set_window() # Another test: try enabling/disabling GL_MULTISAMPLE_ARB... # seems to have no effect if samples > 4. if symbol == key.N: self.soft_multisample = not self.soft_multisample if self.soft_multisample: print 'Enabling GL_MULTISAMPLE_ARB' glEnable(GL_MULTISAMPLE_ARB) else: print 'Disabling GL_MULTISAMPLE_ARB' glDisable(GL_MULTISAMPLE_ARB)
Example #2
Source File: test_window_multisample.py From pyglet with BSD 3-Clause "New" or "Revised" License | 6 votes |
def on_key_press(self, symbol, modifiers): mod = 1 if modifiers & key.MOD_SHIFT: mod = -1 if symbol == key.M: self.multisample = not self.multisample self.set_window() if symbol == key.S: self.samples += 2 * mod self.samples = max(2, self.samples) self.set_window() # Another test: try enabling/disabling GL_MULTISAMPLE_ARB... # seems to have no effect if samples > 4. if symbol == key.N: self.soft_multisample = not self.soft_multisample if self.soft_multisample: print('Enabling GL_MULTISAMPLE_ARB') glEnable(GL_MULTISAMPLE_ARB) else: print('Disabling GL_MULTISAMPLE_ARB') glDisable(GL_MULTISAMPLE_ARB)
Example #3
Source File: player_agent.py From playground with Apache License 2.0 | 5 votes |
def __init__(self, character=characters.Bomber, agent_control='arrows'): super(PlayerAgent, self).__init__(character) ## # @NOTE: DO NOT move this import outside the constructor. It will # not work in headless environments like a Docker container # and prevents Pommerman from running. # from pyglet.window import key controls = { 'arrows': { key.UP: 1, key.DOWN: 2, key.LEFT: 3, key.RIGHT: 4, key.SPACE: 5, key.M: 6 # In Pommerman, this will freeze the game. }, 'wasd': { key.W: 1, key.S: 2, key.A: 3, key.D: 4, key.E: 5, key.Q: 6 # In Pommerman, this will freeze the game. } } assert agent_control in controls, "Unknown control: {}".format( agent_control) self._key2act = controls[agent_control] self._action_q = [] self._keystate = {}