本文整理了Java中org.lwjgl.glfw.GLFW.nglfwGetFramebufferSize()
方法的一些代码示例,展示了GLFW.nglfwGetFramebufferSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.nglfwGetFramebufferSize()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:nglfwGetFramebufferSize
[英]Unsafe version of: #glfwGetFramebufferSize
[中]不安全版本:#glfwGetFramebufferSize
代码示例来源:origin: sriharshachilakapati/SilenceEngine
/**
* This method retrieves the size, in pixels, of the framebuffer of this window. If you wish to retrieve the size of
* the window in screen coordinates, see {@link Window#getSize()}.
*
* @return The size of the window framebuffer, in pixels, as a Vector2.
*/
public Vector2 getFramebufferSize()
{
IntBuffer size = BufferUtils.createIntBuffer(2);
nglfwGetFramebufferSize(handle, memAddress(size), memAddress(size) + Integer.BYTES);
return framebufferSize.set(size.get(0), size.get(1));
}
代码示例来源:origin: org.lwjgl.osgi/org.lwjgl.glfw
/**
* Retrieves the size, in pixels, of the framebuffer of the specified window. If you wish to retrieve the size of the window in screen coordinates, see
* {@link #glfwGetWindowSize GetWindowSize}.
*
* <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>
*
* <p>This function must only be called from the main thread.</p>
*
* @param window the window whose framebuffer to query
* @param width where to store the width, in pixels, of the framebuffer, or {@code NULL}
* @param height where to store the height, in pixels, of the framebuffer, or {@code NULL}
*
* @since version 3.0
*/
public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") IntBuffer width, @Nullable @NativeType("int *") IntBuffer height) {
if (CHECKS) {
checkSafe(width, 1);
checkSafe(height, 1);
}
nglfwGetFramebufferSize(window, memAddressSafe(width), memAddressSafe(height));
}
代码示例来源:origin: playn/playn
@Override public void setSize (int width, int height, boolean fullscreen) {
if (plat.config.fullscreen != fullscreen) {
plat.log().warn("fullscreen cannot be changed via setSize, use config.fullscreen instead");
return;
}
GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
if (width > vidMode.width()) {
plat.log().debug("Capping window width at desktop width: " + width + " -> " +
vidMode.width());
width = vidMode.width();
}
if (height > vidMode.height()) {
plat.log().debug("Capping window height at desktop height: " + height + " -> " +
vidMode.height());
height = vidMode.height();
}
glfwSetWindowSize(window, width, height);
// plat.log().info("setSize: " + width + "x" + height);
viewSizeM.setSize(width, height);
IntBuffer fbSize = BufferUtils.createIntBuffer(2);
long addr = MemoryUtil.memAddress(fbSize);
nglfwGetFramebufferSize(window, addr, addr + 4);
viewportAndScaleChanged(fbSize.get(0), fbSize.get(1));
}
内容来源于网络,如有侵权,请联系作者删除!