本文整理了Java中org.lwjgl.glfw.GLFW.nglfwGetMonitorPhysicalSize()
方法的一些代码示例,展示了GLFW.nglfwGetMonitorPhysicalSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.nglfwGetMonitorPhysicalSize()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:nglfwGetMonitorPhysicalSize
[英]Unsafe version of: #glfwGetMonitorPhysicalSize
[中]不安全版本:#glfwGetMonitorPhysicalSize
代码示例来源:origin: sriharshachilakapati/SilenceEngine
/**
* <p> This method returns the size, in millimetres, of the display area of the specified monitor.</p>
*
* <p> Some systems do not provide accurate monitor size information, either because the monitor EDID data is
* incorrect or because the driver does not report it accurately.</p>
*
* <p> If an error occurs, the size components will be set to zero.</p>
*
* @return The physical size of this monitor in millimeters as a Vector2. The x-component is the width and the
* y-component is the height of the monitor.
*/
public Vector2 getPhysicalSize()
{
IntBuffer sizeBuffer = BufferUtils.createIntBuffer(2);
long addressWidth = MemoryUtil.memAddress(sizeBuffer);
long addressHeight = addressWidth + Integer.BYTES;
nglfwGetMonitorPhysicalSize(handle, addressWidth, addressHeight);
Vector2 size = new Vector2(sizeBuffer.get(0), sizeBuffer.get(1));
return size;
}
代码示例来源:origin: org.lwjgl.osgi/org.lwjgl.glfw
/**
* Returns the size, in millimetres, of the display area of the specified monitor.
*
* <p>Some systems do not provide accurate monitor size information, either because the monitor
* <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
* accurately.</p>
*
* <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>
*
* <div style="margin-left: 26px; border-left: 1px solid gray; padding-left: 14px;"><h5>Note</h5>
*
* <ul>
* <li>This function must only be called from the main thread.</li>
* <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>
* </ul></div>
*
* @param monitor the monitor to query
* @param widthMM where to store the width, in millimetres, of the monitor's display area, or {@code NULL}
* @param heightMM where to store the height, in millimetres, of the monitor's display area, or {@code NULL}
*
* @since version 3.0
*/
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") IntBuffer widthMM, @Nullable @NativeType("int *") IntBuffer heightMM) {
if (CHECKS) {
checkSafe(widthMM, 1);
checkSafe(heightMM, 1);
}
nglfwGetMonitorPhysicalSize(monitor, memAddressSafe(widthMM), memAddressSafe(heightMM));
}
内容来源于网络,如有侵权,请联系作者删除!