本文整理汇总了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)
示例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)
示例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)
示例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.')
示例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.')
示例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
示例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
示例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
示例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
示例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.'
示例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.'
示例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)
示例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)
示例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)
示例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.')