当前位置: 首页>>代码示例>>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;未经允许,请勿转载。