本文整理了Java中org.lwjgl.glfw.GLFW.glfwGetWindowSize()
方法的一些代码示例,展示了GLFW.glfwGetWindowSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwGetWindowSize()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwGetWindowSize
[英]Retrieves the size, in screen coordinates, of the client area of the specified window. If you wish to retrieve the size of the framebuffer of the window in pixels, see #glfwGetFramebufferSize.
Any or all of the size arguments may be NULL. If an error occurs, all non- NULL size arguments will be set to zero.
This function must only be called from the main thread.
[中]检索指定窗口的客户端区域的大小(以屏幕坐标为单位)。如果要以像素为单位检索窗口的帧缓冲区大小,请参阅#glfwGetFramebufferSize。
任何或所有大小参数都可能为空。如果发生错误,所有非NULL大小的参数都将设置为零。
只能从主线程调用此函数。
代码示例来源:origin: libgdx/libgdx
private void updateFramebufferInfo() {
GLFW.glfwGetFramebufferSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
this.backBufferWidth = tmpBuffer.get(0);
this.backBufferHeight = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
Lwjgl3Graphics.this.logicalWidth = tmpBuffer.get(0);
Lwjgl3Graphics.this.logicalHeight = tmpBuffer2.get(0);
Lwjgl3ApplicationConfiguration config = window.getConfig();
bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil,
config.samples, false);
}
代码示例来源:origin: libgdx/libgdx
private void updateFramebufferInfo() {
GLFW.glfwGetFramebufferSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
this.backBufferWidth = tmpBuffer.get(0);
this.backBufferHeight = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
Lwjgl3Graphics.this.logicalWidth = tmpBuffer.get(0);
Lwjgl3Graphics.this.logicalHeight = tmpBuffer2.get(0);
Lwjgl3ApplicationConfiguration config = window.getConfig();
bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil,
config.samples, false);
}
代码示例来源:origin: libgdx/libgdx
@Override
public Monitor getMonitor() {
Monitor[] monitors = getMonitors();
Monitor result = monitors[0];
GLFW.glfwGetWindowPos(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowX = tmpBuffer.get(0);
int windowY = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowWidth = tmpBuffer.get(0);
int windowHeight = tmpBuffer2.get(0);
int overlap;
int bestOverlap = 0;
for (Monitor monitor : monitors) {
DisplayMode mode = getDisplayMode(monitor);
overlap = Math.max(0,
Math.min(windowX + windowWidth, monitor.virtualX + mode.width)
- Math.max(windowX, monitor.virtualX))
* Math.max(0, Math.min(windowY + windowHeight, monitor.virtualY + mode.height)
- Math.max(windowY, monitor.virtualY));
if (bestOverlap < overlap) {
bestOverlap = overlap;
result = monitor;
}
}
return result;
}
代码示例来源:origin: libgdx/libgdx
@Override
public Monitor getMonitor() {
Monitor[] monitors = getMonitors();
Monitor result = monitors[0];
GLFW.glfwGetWindowPos(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowX = tmpBuffer.get(0);
int windowY = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowWidth = tmpBuffer.get(0);
int windowHeight = tmpBuffer2.get(0);
int overlap;
int bestOverlap = 0;
for (Monitor monitor : monitors) {
DisplayMode mode = getDisplayMode(monitor);
overlap = Math.max(0,
Math.min(windowX + windowWidth, monitor.virtualX + mode.width)
- Math.max(windowX, monitor.virtualX))
* Math.max(0, Math.min(windowY + windowHeight, monitor.virtualY + mode.height)
- Math.max(windowY, monitor.virtualY));
if (bestOverlap < overlap) {
bestOverlap = overlap;
result = monitor;
}
}
return result;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
final IntBuffer height = stack.callocInt(1);
glfwGetWindowSize(window, width, height);
代码示例来源:origin: WarmfulDevelopment/LWJGL-3-Tutorial
public Vector2f getMousePosition() {
glfwGetCursorPos(window, x, y);
glfwGetWindowSize(window, winWidth, winHeight);
mousePos.set((float) x[0] - (winWidth[0] / 2.0f), -((float) y[0] - (winHeight[0] / 2.0f)));
return mousePos;
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3
private void updateFramebufferInfo() {
GLFW.glfwGetFramebufferSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
this.backBufferWidth = tmpBuffer.get(0);
this.backBufferHeight = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
Lwjgl3Graphics.this.logicalWidth = tmpBuffer.get(0);
Lwjgl3Graphics.this.logicalHeight = tmpBuffer2.get(0);
Lwjgl3ApplicationConfiguration config = window.getConfig();
bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil,
config.samples, false);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3
@Override
public Monitor getMonitor() {
Monitor[] monitors = getMonitors();
Monitor result = monitors[0];
GLFW.glfwGetWindowPos(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowX = tmpBuffer.get(0);
int windowY = tmpBuffer2.get(0);
GLFW.glfwGetWindowSize(window.getWindowHandle(), tmpBuffer, tmpBuffer2);
int windowWidth = tmpBuffer.get(0);
int windowHeight = tmpBuffer2.get(0);
int overlap;
int bestOverlap = 0;
for (Monitor monitor : monitors) {
DisplayMode mode = getDisplayMode(monitor);
overlap = Math.max(0,
Math.min(windowX + windowWidth, monitor.virtualX + mode.width)
- Math.max(windowX, monitor.virtualX))
* Math.max(0, Math.min(windowY + windowHeight, monitor.virtualY + mode.height)
- Math.max(windowY, monitor.virtualY));
if (bestOverlap < overlap) {
bestOverlap = overlap;
result = monitor;
}
}
return result;
}
代码示例来源:origin: SpinyOwl/legui
/**
* Update glfw window.
*/
public void updateGlfwWindow() {
int[] windowWidth = {0},
windowHeight = {0};
int[] frameBufferWidth = {0},
frameBufferHeight = {0};
int[] xpos = {0},
ypos = {0};
glfwGetWindowSize(glfwWindow, windowWidth, windowHeight);
glfwGetFramebufferSize(glfwWindow, frameBufferWidth, frameBufferHeight);
glfwGetWindowPos(glfwWindow, xpos, ypos);
update(windowWidth[0], windowHeight[0],
frameBufferWidth[0], frameBufferHeight[0],
xpos[0], ypos[0],
glfwGetWindowAttrib(glfwWindow, GLFW_ICONIFIED) == GLFW_TRUE
);
}
内容来源于网络,如有侵权,请联系作者删除!