本文整理汇总了Python中glfw.KEY_LEFT属性的典型用法代码示例。如果您正苦于以下问题:Python glfw.KEY_LEFT属性的具体用法?Python glfw.KEY_LEFT怎么用?Python glfw.KEY_LEFT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类glfw
的用法示例。
在下文中一共展示了glfw.KEY_LEFT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _map_keys
# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import KEY_LEFT [as 别名]
def _map_keys(self):
key_map = self.io.key_map
key_map[imgui.KEY_TAB] = glfw.KEY_TAB
key_map[imgui.KEY_LEFT_ARROW] = glfw.KEY_LEFT
key_map[imgui.KEY_RIGHT_ARROW] = glfw.KEY_RIGHT
key_map[imgui.KEY_UP_ARROW] = glfw.KEY_UP
key_map[imgui.KEY_DOWN_ARROW] = glfw.KEY_DOWN
key_map[imgui.KEY_PAGE_UP] = glfw.KEY_PAGE_UP
key_map[imgui.KEY_PAGE_DOWN] = glfw.KEY_PAGE_DOWN
key_map[imgui.KEY_HOME] = glfw.KEY_HOME
key_map[imgui.KEY_END] = glfw.KEY_END
key_map[imgui.KEY_DELETE] = glfw.KEY_DELETE
key_map[imgui.KEY_BACKSPACE] = glfw.KEY_BACKSPACE
key_map[imgui.KEY_ENTER] = glfw.KEY_ENTER
key_map[imgui.KEY_ESCAPE] = glfw.KEY_ESCAPE
key_map[imgui.KEY_A] = glfw.KEY_A
key_map[imgui.KEY_C] = glfw.KEY_C
key_map[imgui.KEY_V] = glfw.KEY_V
key_map[imgui.KEY_X] = glfw.KEY_X
key_map[imgui.KEY_Y] = glfw.KEY_Y
key_map[imgui.KEY_Z] = glfw.KEY_Z
示例2: keyboard_callback
# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import KEY_LEFT [as 别名]
def keyboard_callback(self, window, key, scancode, action, mods):
self.impl.keyboard_callback(window, key, scancode, action, mods)
if not imgui.get_io().want_capture_keyboard:
if key == glfw.KEY_B or key == glfw.KEY_LEFT:
self.currentTimestep = self.sliderValue = max(0, self.currentTimestep - 1)
if key == glfw.KEY_N or key == glfw.KEY_RIGHT:
self.currentTimestep = self.sliderValue = min(self.num_scans - 1, self.currentTimestep + 1)
if key == glfw.KEY_Q or key == glfw.KEY_ESCAPE:
exit(0)
示例3: on_press
# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import KEY_LEFT [as 别名]
def on_press(self, window, key, scancode, action, mods):
"""
Key handler for key presses.
"""
# controls for moving position
if key == glfw.KEY_W:
# move forward
move_camera(env=self.env, direction=[0., 0., -1.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_S:
# move backward
move_camera(env=self.env, direction=[0., 0., 1.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_A:
# move left
move_camera(env=self.env, direction=[-1., 0., 0.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_D:
# move right
move_camera(env=self.env, direction=[1., 0., 0.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_R:
# move up
move_camera(env=self.env, direction=[0., 1., 0.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_F:
# move down
move_camera(env=self.env, direction=[0., -1., 0.], scale=DELTA_POS_KEY_PRESS, camera_id=self.camera_id)
# controls for moving rotation
elif key == glfw.KEY_UP:
# rotate up
rotate_camera(env=self.env, direction=[1., 0., 0.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_DOWN:
# rotate down
rotate_camera(env=self.env, direction=[-1., 0., 0.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_LEFT:
# rotate left
rotate_camera(env=self.env, direction=[0., 1., 0.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_RIGHT:
# rotate right
rotate_camera(env=self.env, direction=[0., -1., 0.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_PERIOD:
# rotate counterclockwise
rotate_camera(env=self.env, direction=[0., 0., 1.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)
elif key == glfw.KEY_SLASH:
# rotate clockwise
rotate_camera(env=self.env, direction=[0., 0., -1.], angle=DELTA_ROT_KEY_PRESS, camera_id=self.camera_id)