org.lwjgl.glfw.GLFW.glfwGetMouseButton()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中org.lwjgl.glfw.GLFW.glfwGetMouseButton()方法的一些代码示例,展示了GLFW.glfwGetMouseButton()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwGetMouseButton()方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwGetMouseButton

GLFW.glfwGetMouseButton介绍

[英]Returns the last state reported for the specified mouse button to the specified window. The returned state is one of #GLFW_PRESS or #GLFW_RELEASE. The higher-level action #GLFW_REPEAT is only reported to the mouse button callback.

If the #GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function returns #GLFW_PRESS the first time you call it for a mouse button that was pressed, even if that mouse button has already been released.

This function must only be called from the main thread.
[中]将指定鼠标按钮的上次报告状态返回到指定窗口。返回的状态是#GLFW_PRESS或#GLFW_RELEASE。更高级别的操作#GLFW_REPEAT仅报告给鼠标按钮回调。
如果启用了#GLFW_STICKY_MOUSE_BUTTONS输入模式,则此函数将在您第一次调用已按下的鼠标按钮时返回#GLFW_PRESS,即使该鼠标按钮已被释放。
只能从主线程调用此函数。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public boolean isTouched() {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_1) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_2) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_3) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_4) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_5) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: libgdx/libgdx

@Override
public boolean isButtonPressed(int button) {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), button) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: libgdx/libgdx

@Override
public boolean isTouched() {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_1) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_2) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_3) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_4) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_5) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: libgdx/libgdx

@Override
public boolean isButtonPressed(int button) {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), button) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: WarmfulDevelopment/LWJGL-3-Tutorial

public boolean isMouseButtonDown(int button) {
  return glfwGetMouseButton(window, button) == 1;
}

代码示例来源:origin: sriharshachilakapati/SilenceEngine

/**
 * <p> This method returns the last state reported for the specified mouse button to the specified window. The
 * returned state is one of {@code GLFW_PRESS} or {@code GLFW_RELEASE}.</p>
 *
 * <p> If the {@code GLFW_STICKY_MOUSE_BUTTONS} input mode is enabled, this method {@code GLFW_PRESS} the
 * first time you call it for a mouse button that was pressed, even if that mouse button has already been released.
 * </p>
 *
 * @param button The desired mouse button.
 *
 * @return One of {@code GLFW_PRESS} or {@code GLFW_RELEASE}.
 *
 * @see Window#setInputMode(int, int)
 */
public int getMouseButton(int button)
{
  return glfwGetMouseButton(handle, button);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3

@Override
public boolean isTouched() {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_1) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_2) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_3) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_4) == GLFW.GLFW_PRESS ||
      GLFW.glfwGetMouseButton(window.getWindowHandle(), GLFW.GLFW_MOUSE_BUTTON_5) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3

@Override
public boolean isButtonPressed(int button) {
  return GLFW.glfwGetMouseButton(window.getWindowHandle(), button) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: fynnfluegge/oreon-engine

public void getTerrainPosition(){
  if (isActive() && glfwGetMouseButton(BaseContext.getWindow().getId(),1) == GLFW_PRESS){
    Vec3f pos = new Vec3f(0,0,0);
    DoubleBuffer xPos = BufferUtils.createDoubleBuffer(1);

相关文章

GLFW类方法