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

x33g5p2x  于2022-01-20 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(122)

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

GLFW.nglfwGetMonitorPos介绍

[英]Unsafe version of: #glfwGetMonitorPos
[中]不安全版本:#glfwGetMonitorPos

代码示例

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

/**
 * This method returns the position, in screen coordinates, of the upper-left corner of the specified monitor. If
 * there is any error, the position is set to zero, or the origin.
 *
 * @return The virtual position of this monitor.
 */
public Vector2 getVirtualPosition()
{
  IntBuffer posBuffer = BufferUtils.createIntBuffer(2);
  long posX = MemoryUtil.memAddress(posBuffer);
  long posY = posX + Integer.BYTES;
  nglfwGetMonitorPos(handle, posX, posY);
  Vector2 position = new Vector2(posBuffer.get(0), posBuffer.get(1));
  return position;
}

代码示例来源:origin: org.lwjgl.osgi/org.lwjgl.glfw

/**
 * Returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
 * 
 * <p>Any or all of the position arguments may be {@code NULL}. If an error occurs, all non-{@code NULL} position arguments will be set to zero.</p>
 * 
 * <p>This function must only be called from the main thread.</p>
 *
 * @param monitor the monitor to query
 * @param xpos    where to store the monitor x-coordinate, or {@code NULL}
 * @param ypos    where to store the monitor y-coordinate, or {@code NULL}
 *
 * @since version 3.0
 */
public static void glfwGetMonitorPos(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer xpos, @Nullable @NativeType("int *") IntBuffer ypos) {
  if (CHECKS) {
    checkSafe(xpos, 1);
    checkSafe(ypos, 1);
  }
  nglfwGetMonitorPos(monitor, memAddressSafe(xpos), memAddressSafe(ypos));
}

相关文章

GLFW类方法