当前位置: 首页>>代码示例>>Python>>正文


Python key.M属性代码示例

本文整理汇总了Python中pyglet.window.key.M属性的典型用法代码示例。如果您正苦于以下问题:Python key.M属性的具体用法?Python key.M怎么用?Python key.M使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pyglet.window.key的用法示例。


在下文中一共展示了key.M属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import M [as 别名]
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) 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:25,代码来源:WINDOW_MULTISAMPLE.py

示例2: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import M [as 别名]
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) 
开发者ID:pyglet,项目名称:pyglet,代码行数:25,代码来源:test_window_multisample.py

示例3: __init__

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import M [as 别名]
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 = {} 
开发者ID:MultiAgentLearning,项目名称:playground,代码行数:36,代码来源:player_agent.py


注:本文中的pyglet.window.key.M属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。