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

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

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

GLFW.nglfwGetMonitorPhysicalSize介绍

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

代码示例

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

  1. /**
  2. * <p> This method returns the size, in millimetres, of the display area of the specified monitor.</p>
  3. *
  4. * <p> Some systems do not provide accurate monitor size information, either because the monitor EDID data is
  5. * incorrect or because the driver does not report it accurately.</p>
  6. *
  7. * <p> If an error occurs, the size components will be set to zero.</p>
  8. *
  9. * @return The physical size of this monitor in millimeters as a Vector2. The x-component is the width and the
  10. * y-component is the height of the monitor.
  11. */
  12. public Vector2 getPhysicalSize()
  13. {
  14. IntBuffer sizeBuffer = BufferUtils.createIntBuffer(2);
  15. long addressWidth = MemoryUtil.memAddress(sizeBuffer);
  16. long addressHeight = addressWidth + Integer.BYTES;
  17. nglfwGetMonitorPhysicalSize(handle, addressWidth, addressHeight);
  18. Vector2 size = new Vector2(sizeBuffer.get(0), sizeBuffer.get(1));
  19. return size;
  20. }

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

  1. /**
  2. * Returns the size, in millimetres, of the display area of the specified monitor.
  3. *
  4. * <p>Some systems do not provide accurate monitor size information, either because the monitor
  5. * <a target="_blank" href="https://en.wikipedia.org/wiki/Extended_display_identification_data">EDID</a> data is incorrect or because the driver does not report it
  6. * accurately.</p>
  7. *
  8. * <p>Any or all of the size arguments may be {@code NULL}. If an error occurs, all non-{@code NULL} size arguments will be set to zero.</p>
  9. *
  10. * <div style="margin-left: 26px; border-left: 1px solid gray; padding-left: 14px;"><h5>Note</h5>
  11. *
  12. * <ul>
  13. * <li>This function must only be called from the main thread.</li>
  14. * <li><b>Windows</b>: The OS calculates the returned physical size from the current resolution and system DPI instead of querying the monitor EDID data.</li>
  15. * </ul></div>
  16. *
  17. * @param monitor the monitor to query
  18. * @param widthMM where to store the width, in millimetres, of the monitor's display area, or {@code NULL}
  19. * @param heightMM where to store the height, in millimetres, of the monitor's display area, or {@code NULL}
  20. *
  21. * @since version 3.0
  22. */
  23. public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer widthMM, @Nullable @NativeType("int *") IntBuffer heightMM) {
  24. if (CHECKS) {
  25. checkSafe(widthMM, 1);
  26. checkSafe(heightMM, 1);
  27. }
  28. nglfwGetMonitorPhysicalSize(monitor, memAddressSafe(widthMM), memAddressSafe(heightMM));
  29. }

相关文章

GLFW类方法