本文整理了Java中org.lwjgl.glfw.GLFW.glfwGetWindowPos()
方法的一些代码示例,展示了GLFW.glfwGetWindowPos()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwGetWindowPos()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwGetWindowPos
[英]Retrieves the position, in screen coordinates, of the upper-left corner of the client area of the specified window.
Any or all of the position arguments may be NULL. If an error occurs, all non- NULL position arguments will be set to zero.
Notes:
代码示例来源:origin: libgdx/libgdx
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionX() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer.get(0);
}
代码示例来源:origin: libgdx/libgdx
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionY() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer2.get(0);
}
代码示例来源:origin: libgdx/libgdx
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionY() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer2.get(0);
}
代码示例来源:origin: libgdx/libgdx
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionX() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer.get(0);
}
代码示例来源: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: com.badlogicgames.gdx/gdx-backend-lwjgl3
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionY() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer2.get(0);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3
/** @return the window position in logical coordinates. All monitors
* span a virtual surface together. The coordinates are relative to
* the first monitor in the virtual surface. **/
public int getPositionX() {
GLFW.glfwGetWindowPos(windowHandle, tmpBuffer, tmpBuffer2);
return tmpBuffer.get(0);
}
代码示例来源:origin: nifty-gui/nifty-gui
@Override
public void setMousePosition(final int x, final int y) {
final IntBuffer xpos = IntBuffer.allocate(1);
final IntBuffer ypos = IntBuffer.allocate(1);
glfwGetWindowPos(glfwWindow, xpos, ypos);
glfwSetCursorPos(glfwWindow, x - xpos.get(0), y - ypos.get(0));
}
代码示例来源: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
);
}
内容来源于网络,如有侵权,请联系作者删除!