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


Python glfw.PRESS属性代码示例

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


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

示例1: key_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_callback(self, window, key, scancode, action, mods):
        if action == glfw.PRESS:
            tgt = self.keypress
        elif action == glfw.RELEASE:
            tgt = self.keyup
        elif action == glfw.REPEAT:
            tgt = self.keyrepeat
        else:
            return
        if tgt.get(key):
            for fn in tgt[key]:
                fn(window, key, scancode, action, mods)
        if tgt.get("any"):
            for fn in tgt["any"]:
                fn(window, key, scancode, action, mods)
            # retain functionality for closing the viewer
            if key == glfw.KEY_ESCAPE:
                super().key_callback(window, key, scancode, action, mods)
        else:
            # only use default mujoco callbacks if "any" callbacks are unset
            super().key_callback(window, key, scancode, action, mods) 
开发者ID:StanfordVL,项目名称:robosuite,代码行数:23,代码来源:mujoco_py_renderer.py

示例2: on_mouse_btn

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def on_mouse_btn(self, window, button, action, mods):
    x, y = glfw.get_cursor_pos(self.window)

    imgui.get_io().mouse_pos = (x, y)
    if imgui.get_io().want_capture_mouse:

      return

    if action == glfw.PRESS:
      self.buttonPressed = button
      self.isDrag = True
      self.cam.mousePressed(x, y, self.buttonPressed, None)
    else:
      self.buttonPressed = None
      self.isDrag = False
      self.cam.mouseReleased(x, y, self.buttonPressed, None) 
开发者ID:PRBonn,项目名称:semantic-kitti-api,代码行数:18,代码来源:visualize_voxels.py

示例3: glfw_mouse_button_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def glfw_mouse_button_callback(self, window, button, action, mods):
        """Handle mouse button events and forward them to the example

        Args:
            window: The window
            button: The button creating the event
            action: Button action (press or release)
            mods: They modifiers such as ctrl or shift
        """
        self._handle_modifiers(mods)
        button = self._mouse_button_map.get(button, None)
        if button is None:
            return

        xpos, ypos = glfw.get_cursor_pos(self._window)

        if action == glfw.PRESS:
            self._handle_mouse_button_state_change(button, True)
            self._mouse_press_event_func(xpos, ypos, button)
        else:
            self._handle_mouse_button_state_change(button, False)
            self._mouse_release_event_func(xpos, ypos, button) 
开发者ID:moderngl,项目名称:moderngl-window,代码行数:24,代码来源:window.py

示例4: key_input_clb

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_input_clb(window, key, scancode, action, mode):
    global left, right, forward, backward
    if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
        glfw.set_window_should_close(window, True)

    if key == glfw.KEY_W and action == glfw.PRESS:
        forward = True
    elif key == glfw.KEY_W and action == glfw.RELEASE:
        forward = False
    if key == glfw.KEY_S and action == glfw.PRESS:
        backward = True
    elif key == glfw.KEY_S and action == glfw.RELEASE:
        backward = False
    if key == glfw.KEY_A and action == glfw.PRESS:
        left = True
    elif key == glfw.KEY_A and action == glfw.RELEASE:
        left = False
    if key == glfw.KEY_D and action == glfw.PRESS:
        right = True
    elif key == glfw.KEY_D and action == glfw.RELEASE:
        right = False


# do the movement, call this function in the main loop 
开发者ID:totex,项目名称:Learn-OpenGL-in-python,代码行数:26,代码来源:ep21_texturing_from_framebuffers.py

示例5: keyboard_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def keyboard_callback(self, window, key, scancode, action, mods):
        # perf: local for faster access
        io = self.io

        if action == glfw.PRESS:
            io.keys_down[key] = True
        elif action == glfw.RELEASE:
            io.keys_down[key] = False

        io.key_ctrl = (
            io.keys_down[glfw.KEY_LEFT_CONTROL] or
            io.keys_down[glfw.KEY_RIGHT_CONTROL]
        )

        io.key_alt = (
            io.keys_down[glfw.KEY_LEFT_ALT] or
            io.keys_down[glfw.KEY_RIGHT_ALT]
        )

        io.key_shift = (
            io.keys_down[glfw.KEY_LEFT_SHIFT] or
            io.keys_down[glfw.KEY_RIGHT_SHIFT]
        )

        io.key_super = (
            io.keys_down[glfw.KEY_LEFT_SUPER] or
            io.keys_down[glfw.KEY_RIGHT_SUPER]
        ) 
开发者ID:swistakm,项目名称:pyimgui,代码行数:30,代码来源:glfw.py

示例6: key_input_clb

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_input_clb(window, key, scancode, action, mode):
    global left, right, forward, backward
    if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
        glfw.set_window_should_close(window, True)

    if key == glfw.KEY_W and action == glfw.PRESS:
        forward = True
    elif key == glfw.KEY_W and action == glfw.RELEASE:
        forward = False
    if key == glfw.KEY_S and action == glfw.PRESS:
        backward = True
    elif key == glfw.KEY_S and action == glfw.RELEASE:
        backward = False
    if key == glfw.KEY_A and action == glfw.PRESS:
        left = True
    elif key == glfw.KEY_A and action == glfw.RELEASE:
        left = False
    if key == glfw.KEY_D and action == glfw.PRESS:
        right = True
    elif key == glfw.KEY_D and action == glfw.RELEASE:
        right = False
    # if key in [glfw.KEY_W, glfw.KEY_S, glfw.KEY_D, glfw.KEY_A] and action == glfw.RELEASE:
    #     left, right, forward, backward = False, False, False, False


# do the movement, call this function in the main loop 
开发者ID:totex,项目名称:Learn-OpenGL-in-python,代码行数:28,代码来源:ep18_camera_WASD.py

示例7: mouse_button_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def mouse_button_callback(window, button, action, mods):
    global picker
    if button == glfw.MOUSE_BUTTON_LEFT and action == glfw.PRESS:
        picker = True 
开发者ID:totex,项目名称:Learn-OpenGL-in-python,代码行数:6,代码来源:ep22_color_picking.py

示例8: key_input_clb

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_input_clb(window, key, scancode, action, mode):
    if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
        glfw.set_window_should_close(window, True)


# the mouse position callback function 
开发者ID:totex,项目名称:Learn-OpenGL-in-python,代码行数:8,代码来源:ep17_camera_mouse_capture.py

示例9: _handle_key_event

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def _handle_key_event(self, window, key, scancode, activity, mods):
    """Broadcasts the notification to registered listeners.

    Args:
      window: The window that received the event.
      key: ID representing the key, a glfw.KEY_ constant.
      scancode: The system-specific scancode of the key.
      activity: glfw.PRESS, glfw.RELEASE or glfw.REPEAT.
      mods: Bit field describing which modifier keys were held down, such as Alt
        or Shift.
    """
    del window, scancode
    self.add_event(self.on_key, key, activity, mods) 
开发者ID:deepmind,项目名称:dm_control,代码行数:15,代码来源:glfw_gui.py

示例10: key_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_callback(self, window, key, scancode, action, mods):
        "press ESCAPE to quit the application"
        if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
            glfw.set_window_should_close(self.window, True) 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:6,代码来源:glfw_app.py

示例11: key_callback

# 需要导入模块: import glfw [as 别名]
# 或者: from glfw import PRESS [as 别名]
def key_callback(self, window, key, _scan_code, action, _mods):
        if action == glfw.PRESS:
            if key == glfw.KEY_ESCAPE:
                glfw.set_window_should_close(window, True)
            if key == glfw.KEY_C:
                self.show_cubes = not self.show_cubes 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:8,代码来源:hellovr_glfw.py


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