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


Python mouse.RIGHT属性代码示例

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


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

示例1: _get_mouse_button_and_modifiers

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [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_drag

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [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

示例3: on_mouse_press

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [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

示例4: on_mouse_release

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [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

示例5: _event_rbuttondown

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def _event_rbuttondown(self, msg, wParam, lParam):
        return self._event_mousebutton(
            'on_mouse_press', mouse.RIGHT, lParam) 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:5,代码来源:__init__.py

示例6: _event_rbuttonup

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def _event_rbuttonup(self, msg, wParam, lParam):
        return self._event_mousebutton(
            'on_mouse_release', mouse.RIGHT, lParam) 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:5,代码来源:__init__.py

示例7: on_mouse_press

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [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

示例8: on_mouse_drag

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
        if buttons & mouse.LEFT:
            self.rx += dx
            self.ry += dy
        if buttons & mouse.RIGHT:
            self.x += dx
            self.y += dy 
开发者ID:pyglet,项目名称:pyglet,代码行数:9,代码来源:tree_test.py

示例9: rightMouseDown_

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def rightMouseDown_(self, nsevent):
        x, y = getMousePosition(self, nsevent)
        buttons = mouse.RIGHT
        modifiers = getModifiers(nsevent)
        self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers) 
开发者ID:pyglet,项目名称:pyglet,代码行数:7,代码来源:pyglet_view.py

示例10: rightMouseDragged_

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def rightMouseDragged_(self, nsevent):
        x, y = getMousePosition(self, nsevent)
        dx, dy = getMouseDelta(nsevent)
        buttons = mouse.RIGHT
        modifiers = getModifiers(nsevent)
        self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers) 
开发者ID:pyglet,项目名称:pyglet,代码行数:8,代码来源:pyglet_view.py

示例11: rightMouseUp_

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def rightMouseUp_(self, nsevent):
        x, y = getMousePosition(self, nsevent)
        buttons = mouse.RIGHT
        modifiers = getModifiers(nsevent)
        self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers) 
开发者ID:pyglet,项目名称:pyglet,代码行数:7,代码来源:pyglet_view.py

示例12: _event_motionnotify

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def _event_motionnotify(self, ev):
        # Window motion looks for drags that are outside the view but within
        # the window.
        buttons = 0
        if ev.xmotion.state & xlib.Button1MotionMask:
            buttons |= mouse.LEFT
        if ev.xmotion.state & xlib.Button2MotionMask:
            buttons |= mouse.MIDDLE
        if ev.xmotion.state & xlib.Button3MotionMask:
            buttons |= mouse.RIGHT

        if buttons:
            # Drag event
            x = ev.xmotion.x - self._view_x
            y = self._height - (ev.xmotion.y - self._view_y)

            if self._mouse_in_window:
                dx = x - self._mouse_x
                dy = y - self._mouse_y
            else:
                dx = dy = 0
            self._mouse_x = x
            self._mouse_y = y

            modifiers = self._translate_modifiers(ev.xmotion.state)
            self.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers) 
开发者ID:pyglet,项目名称:pyglet,代码行数:28,代码来源:__init__.py

示例13: on_mouse_press

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def on_mouse_press(self, x, y, button, modifiers):
        """Event handler for the Window.on_mouse_press event.

        Called when a mouse button is pressed. See pyglet docs for button
        amd modifier mappings.

        Parameters
        ----------
        x, y : int
            The coordinates of the mouse click. Always center of the screen if
            the mouse is captured.
        button : int
            Number representing mouse button that was clicked. 1 = left button,
            4 = right button.
        modifiers : int
            Number representing any modifying keys that were pressed when the
            mouse button was clicked.

        """
        if self.exclusive:
            vector = self.get_sight_vector()
            block, previous = self.model.hit_test(self.position, vector)
            if button == mouse.RIGHT or (button == mouse.LEFT and modifiers & key.MOD_CTRL):
                # ON OSX, control + left click = right click.
                if previous:
                    self.model.add_block(previous, self.block)
            elif button == pyglet.window.mouse.LEFT and block:
                texture = self.model.get_block(block)
                if texture != BEDSTONE:
                    self.model.remove_block(block)
                    self.audio.play(self.destroy_sfx)
        else:
            self.set_exclusive_mouse(True) 
开发者ID:XenonLab-Studio,项目名称:TerraCraft,代码行数:35,代码来源:scenes.py

示例14: _event_mousemove

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def _event_mousemove(self, msg, wParam, lParam):
        x, y = self._get_location(lParam)

        if (x, y) == self._exclusive_mouse_client:
            # Ignore the event caused by SetCursorPos
            self._mouse_x = x
            self._mouse_y = y
            return 0

        y = self.height - y

        if self._exclusive_mouse and self._has_focus:
            # Reset mouse position (so we don't hit the edge of the screen).
            _user32.SetCursorPos(*self._exclusive_mouse_screen)

        dx = x - self._mouse_x
        dy = y - self._mouse_y

        if not self._tracking:
            # There is no WM_MOUSEENTER message (!), so fake it from the
            # first WM_MOUSEMOVE event after leaving.  Use self._tracking
            # to determine when to recreate the tracking structure after
            # re-entering (to track the next WM_MOUSELEAVE).
            self._mouse_in_window = True
            self.set_mouse_platform_visible()
            self.dispatch_event('on_mouse_enter', x, y)
            self._tracking = True
            track = TRACKMOUSEEVENT()
            track.cbSize = sizeof(track)
            track.dwFlags = TME_LEAVE
            track.hwndTrack = self._hwnd
            _user32.TrackMouseEvent(byref(track))

        # Don't generate motion/drag events when mouse hasn't moved. (Issue
        # 305)
        if self._mouse_x == x and self._mouse_y == y:
            return 0

        self._mouse_x = x
        self._mouse_y = y

        buttons = 0
        if wParam & MK_LBUTTON:
            buttons |= mouse.LEFT
        if wParam & MK_MBUTTON:
            buttons |= mouse.MIDDLE
        if wParam & MK_RBUTTON:
            buttons |= mouse.RIGHT

        if buttons:
            # Drag event
            modifiers = self._get_modifiers()
            self.dispatch_event('on_mouse_drag',
                x, y, dx, dy, buttons, modifiers)
        else:
            # Motion event
            self.dispatch_event('on_mouse_motion', x, y, dx, dy)
        return 0 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:60,代码来源:__init__.py

示例15: _event_motionnotify

# 需要导入模块: from pyglet.window import mouse [as 别名]
# 或者: from pyglet.window.mouse import RIGHT [as 别名]
def _event_motionnotify(self, ev):
        x = ev.xmotion.x
        y = self.height - ev.xmotion.y

        if self._mouse_in_window:
            dx = x - self._mouse_x
            dy = y - self._mouse_y
        else:
            dx = dy = 0

        if self._applied_mouse_exclusive and \
           (ev.xmotion.x, ev.xmotion.y) == self._mouse_exclusive_client:
            # Ignore events caused by XWarpPointer
            self._mouse_x = x
            self._mouse_y = y
            return

        if self._applied_mouse_exclusive:
            # Reset pointer position
            ex, ey = self._mouse_exclusive_client
            xlib.XWarpPointer(self._x_display,
                0,
                self._window,
                0, 0,
                0, 0,
                ex, ey)

        self._mouse_x = x
        self._mouse_y = y
        self._mouse_in_window = True

        buttons = 0
        if ev.xmotion.state & xlib.Button1MotionMask:
            buttons |= mouse.LEFT
        if ev.xmotion.state & xlib.Button2MotionMask:
            buttons |= mouse.MIDDLE
        if ev.xmotion.state & xlib.Button3MotionMask:
            buttons |= mouse.RIGHT

        if buttons:
            # Drag event
            modifiers = self._translate_modifiers(ev.xmotion.state)
            self.dispatch_event('on_mouse_drag',
                x, y, dx, dy, buttons, modifiers)
        else:
            # Motion event
            self.dispatch_event('on_mouse_motion', x, y, dx, dy) 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:49,代码来源:__init__.py


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