當前位置: 首頁>>代碼示例>>Python>>正文


Python mouse.LEFT屬性代碼示例

本文整理匯總了Python中pyglet.window.mouse.LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Python mouse.LEFT屬性的具體用法?Python mouse.LEFT怎麽用?Python mouse.LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在pyglet.window.mouse的用法示例。


在下文中一共展示了mouse.LEFT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_mouse_button_and_modifiers

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def _get_mouse_button_and_modifiers(ev):
        button = EventMouseButton()
        carbon.GetEventParameter(ev, kEventParamMouseButton,
            typeMouseButton, c_void_p(), sizeof(button), c_void_p(),
            byref(button))

        if button.value == 1:
            button = mouse.LEFT
        elif button.value == 2:
            button = mouse.RIGHT
        elif button.value == 3:
            button = mouse.MIDDLE
        else:
            button = None

        modifiers = c_uint32()
        carbon.GetEventParameter(ev, kEventParamKeyModifiers,
            typeUInt32, c_void_p(), sizeof(modifiers), c_void_p(),
            byref(modifiers))

        return button, CarbonWindow._map_modifiers(modifiers.value) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:23,代碼來源:__init__.py

示例2: on_mouse_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_press(self, x, y, button, modifiers):
        if button & mouse.LEFT:
            with self.shader:
                self.shader.uniformf("iMouse", x, y, x, y) 
開發者ID:neozhaoliang,項目名稱:pywonderland,代碼行數:6,代碼來源:loxodrome.py

示例3: on_mouse_drag

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
        if button & mouse.LEFT:
            with self.shader:
                x += dx
                y += dy
                x = max(min(x, self.width), 0)
                y = max(min(y, self.height), 0)
                self.shader.uniformf("iMouse", x, y, x, y) 
開發者ID:neozhaoliang,項目名稱:pywonderland,代碼行數:10,代碼來源:loxodrome.py

示例4: on_key_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_key_press(symbol, modifiers):
    print("key %s was pressed" % symbol)
    if symbol == key.A:
        print('The "A" key was pressed.')
    elif symbol == key.LEFT:
        print('The left arrow key was pressed.')
    elif symbol == key.ENTER:
        print('The enter key was pressed.') 
開發者ID:Akagi201,項目名稱:learning-python,代碼行數:10,代碼來源:events.py

示例5: on_mouse_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_press(x, y, button, modifiers):
    print("location: (%s, %s), button: %s" % (x, y, button))
    if button == mouse.LEFT:
        print('The left mouse button was pressed.') 
開發者ID:Akagi201,項目名稱:learning-python,代碼行數:6,代碼來源:events.py

示例6: on_mouse_drag

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
        self.io.mouse_pos = x, self.io.display_size.y - y

        if button == mouse.LEFT:
            self.io.mouse_down[0] = 1

        if button == mouse.MIDDLE:
            self.io.mouse_down[1] = 1

        if button == mouse.RIGHT:
            self.io.mouse_down[2] = 1 
開發者ID:swistakm,項目名稱:pyimgui,代碼行數:13,代碼來源:pyglet.py

示例7: on_mouse_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_press(self, x, y, button, modifiers):
        self.io.mouse_pos = x, self.io.display_size.y - y

        if button == mouse.LEFT:
            self.io.mouse_down[0] = 1

        if button == mouse.MIDDLE:
            self.io.mouse_down[1] = 1

        if button == mouse.RIGHT:
            self.io.mouse_down[2] = 1 
開發者ID:swistakm,項目名稱:pyimgui,代碼行數:13,代碼來源:pyglet.py

示例8: on_mouse_release

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_release(self, x, y, button, modifiers):
        self.io.mouse_pos = x, self.io.display_size.y - y

        if button == mouse.LEFT:
            self.io.mouse_down[0] = 0

        if button == mouse.MIDDLE:
            self.io.mouse_down[1] = 0

        if button == mouse.RIGHT:
            self.io.mouse_down[2] = 0 
開發者ID:swistakm,項目名稱:pyimgui,代碼行數:13,代碼來源:pyglet.py

示例9: on_mouse_release

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_release(x, y, button, modifiers):
    if button == mouse.LEFT:
        print 'The left mouse button was released at %d, %d' % (x, y)

    """ Add logic for switching game states """
    if state.INSTRUCTIONS:
        state.change('gameplay')
        
    if state.TITLE_SCREEN:
        if smallScreen:
            # Play button logic
            if x > 21 and x < 60 and y > 63 and y < 75:
                state.change('instructions')
            # Score button logic
            if x > 80 and x < 119 and y > 63 and y < 75:
                state.change('highscores')

        if bigScreen:
            # Play button logic
            if x > 43 and x < 121 and y > 125 and y < 148:
                state.change('instructions')
            # Score button logic
            if x > 160 and x < 240 and y > 125 and y < 148:
                state.change('highscores')

    if state.GAME_PLAY_STARTED:
        player.jump()

    if state.GAME_OVER:
        pass
    if state.HIGH_SCORES_SCREEN:
        pass 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:34,代碼來源:window.py

示例10: on_key_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_key_press(symbol, modifiers):
    if symbol == key.A:
        print 'The "A" key was pressed.'
    elif symbol == key.LEFT:
        print 'The left arrow key was pressed.'
    elif symbol == key.ENTER:
        print 'The enter key was pressed.' 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:9,代碼來源:events.py

示例11: on_mouse_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_press(x, y, button, modifiers):
    if button == mouse.LEFT:
        print 'The left mouse button was pressed.' 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:5,代碼來源:events.py

示例12: _event_lbuttonup

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def _event_lbuttonup(self, msg, wParam, lParam):
        return self._event_mousebutton(
            'on_mouse_release', mouse.LEFT, lParam) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:5,代碼來源:__init__.py

示例13: _event_lbuttondown

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def _event_lbuttondown(self, msg, wParam, lParam):
        return self._event_mousebutton(
            'on_mouse_press', mouse.LEFT, lParam) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:5,代碼來源:__init__.py

示例14: on_mouse_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_mouse_press(self, x, y, button, modifiers):
        if (button == mouse.RIGHT) or \
                ((button == mouse.LEFT) and (modifiers & key.MOD_CTRL)):
            block, previous = self.player.hit(self.world.area.blocks, left=False)
            # ON OSX, control + left click = right click.
            if block and self.player.current_item:
                self.world.add_block(previous, get_block(self.player.get_block()))

        elif button == mouse.LEFT:
            block = self.player.hit(self.world.area.blocks)[0]
            if block:
                texture = self.world.area.get_block(block)
                if texture.hit_and_destroy():
                    self.world.remove_block(block) 
開發者ID:traverseda,項目名稱:pycraft,代碼行數:16,代碼來源:gs_running.py

示例15: on_key_press

# 需要導入模塊: from pyglet.window import mouse [as 別名]
# 或者: from pyglet.window.mouse import LEFT [as 別名]
def on_key_press(symbol, modifiers):
    if symbol == key.A:
        print('The "A" key was pressed.')
    elif symbol == key.LEFT:
        print('The left arrow key was pressed.')
    elif symbol == key.ENTER:
        print('The enter key was pressed.') 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:9,代碼來源:events.py


注:本文中的pyglet.window.mouse.LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。