當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。