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

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

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

GLFW.glfwGetKey介绍

[英]Returns the last state reported for the specified key 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 key callback.

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

The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.

The modifier key bit masks are not key tokens and cannot be used with this function.

Do not use this function to implement text input.

Note
  • This function must only be called from the main thread.
  • #GLFW_KEY_UNKNOWN is not a valid key for this function.
    [中]将指定键的上次报告状态返回到指定窗口。返回的状态是#GLFW_PRESS或#GLFW_RELEASE。更高级别的操作#GLFW_REPEAT只报告给键回调。
    如果启用了#GLFW_STICKY_KEYS(粘滞键)输入模式,则此函数在您第一次调用该键时返回#GLFW_PRESS(粘滞键),即使该键已被释放。
    按键功能处理物理按键,按键标记以其在标准美国键盘布局上的使用命名。如果要输入文本,请改用Unicode字符回调。
    修饰符密钥位掩码不是密钥令牌,不能与此函数一起使用。
    不要使用此函数实现text input
    #####注
    *只能从主线程调用此函数。
    *#GLFW_KEY_UNKNOWN不是此函数的有效密钥。

代码示例

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

@Override
public boolean isKeyPressed(int key) {
  if (key == Input.Keys.ANY_KEY) return pressedKeys > 0;
  if (key == Input.Keys.SYM) {					
    return GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_LEFT_SUPER) == GLFW.GLFW_PRESS|| 
        GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_RIGHT_SUPER) == GLFW.GLFW_PRESS;
  }
  return GLFW.glfwGetKey(window.getWindowHandle(), getGlfwKeyCode(key)) == GLFW.GLFW_PRESS;
}

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

@Override
public boolean isKeyPressed(int key) {
  if (key == Input.Keys.ANY_KEY) return pressedKeys > 0;
  if (key == Input.Keys.SYM) {					
    return GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_LEFT_SUPER) == GLFW.GLFW_PRESS|| 
        GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_RIGHT_SUPER) == GLFW.GLFW_PRESS;
  }
  return GLFW.glfwGetKey(window.getWindowHandle(), getGlfwKeyCode(key)) == GLFW.GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public boolean isKeyPressed(int keyCode) {
  return glfwGetKey(windowHandle, keyCode) == GLFW_PRESS;
}

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

@Override
public boolean isKeyPressed(int key) {
  if (key == Input.Keys.ANY_KEY) return pressedKeys > 0;
  if (key == Input.Keys.SYM) {					
    return GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_LEFT_SUPER) == GLFW.GLFW_PRESS|| 
        GLFW.glfwGetKey(window.getWindowHandle(), GLFW.GLFW_KEY_RIGHT_SUPER) == GLFW.GLFW_PRESS;
  }
  return GLFW.glfwGetKey(window.getWindowHandle(), getGlfwKeyCode(key)) == GLFW.GLFW_PRESS;
}

相关文章

GLFW类方法