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


Python key._3属性代码示例

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


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

示例1: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import _3 [as 别名]
def on_key_press(self, symbol, modifiers):
        if symbol == key._1:
            self.apply = not self.apply
            with self.shader:
                self.shader.uniformi("iApply", self.apply)

        if symbol == key._2:
            self.hyperbolic = not self.hyperbolic
            with self.shader:
                self.shader.uniformi("iHyperbolic", self.hyperbolic)

        if symbol == key._3:
            self.elliptic = not self.elliptic
            with self.shader:
                self.shader.uniformi("iElliptic", self.elliptic)

        if symbol == key.V and (modifiers & key.LCTRL):
            self.switch_video()

        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:26,代码来源:Mobius_in_H3space.py

示例2: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import _3 [as 别名]
def on_key_press(self, symbol, modifiers):
        fullscreen = not modifiers & key.MOD_CTRL
        doing = fullscreen and 'Setting' or 'Restoring from'
        if symbol == key._0:
            print('%s default size' % doing)
            self.w.set_fullscreen(fullscreen)
            return
        elif symbol == key._1:
            width, height = 320, 200
        elif symbol == key._2:
            width, height = 640, 480
        elif symbol == key._3:
            width, height = 800, 600
        elif symbol == key._4:
            width, height = 1024, 768
        elif symbol == key._5:
            width, height = 1280, 800 # 16:10
        elif symbol == key._6:
            width, height = 1280, 1024
        else:
            return
        print('%s width=%d, height=%d' % (doing, width, height))
        self.w.set_fullscreen(fullscreen, width=width, height=height) 
开发者ID:pyglet,项目名称:pyglet,代码行数:25,代码来源:test_window_fullscreen.py

示例3: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import _3 [as 别名]
def on_key_press(self, symbol, modifiers):
        """Event handler for the Window.on_key_press event."""
        if symbol == key.ENTER:
            self.scene_manager.change_scene('GameScene')
        elif symbol == key.ESCAPE:
            self.window.set_exclusive_mouse(False)
            return pyglet.event.EVENT_HANDLED

        if symbol in (key._1, key._2, key._3):
            if symbol == key._1:
                self.scene_manager.save.save_slot = 1
            elif symbol == key._2:
                self.scene_manager.save.save_slot = 2
            elif symbol == key._3:
                self.scene_manager.save.save_slot = 3
            self._highlight_save_slot() 
开发者ID:XenonLab-Studio,项目名称:TerraCraft,代码行数:18,代码来源:scenes.py

示例4: __init__

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import _3 [as 别名]
def __init__(self, x, y):
        super().__init__(PLAYER_IMAGE, x=x, y=y)
        self.original_width = PLAYER_IMAGE.width
        self.original_height = PLAYER_IMAGE.height

        self.weapons = {
            key._1: Hand(),
            key._2: SnowSpread(),
            key._3: RocketPropelledSnowball(),

        }
        self.weapon = self.weapons[key._1]
        self.firing = False 
开发者ID:python-discord,项目名称:code-jam-5,代码行数:15,代码来源:player.py


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