本文整理了Java中org.lwjgl.glfw.GLFW.glfwSetCursorPos()
方法的一些代码示例,展示了GLFW.glfwSetCursorPos()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwSetCursorPos()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwSetCursorPos
[英]Sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the client area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.
Do not use this function to implement things like camera controls. GLFW already provides the #GLFW_CURSOR_DISABLED cursor mode that hides the cursor, transparently re-centers it and provides unconstrained cursor motion. See #glfwSetInputMode for more information.
If the cursor mode is #GLFW_CURSOR_DISABLED then the cursor position is unconstrained and limited only by the minimum and maximum values of double.
Notes:
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Set the position of the cursor on the display.
* @param x the x position of the cursor (pixel).
* @param y the y position of the cursor (pixel).
*/
public void setCursorPosition(int x, int y) {
if (!context.isRenderable()) {
return;
}
glfwSetCursorPos(context.getWindowHandle(), x, y);
}
代码示例来源:origin: FedUni/caliko
glfwSetCursorPos(windowId, ((double)mWindowWidth / 2), ((double)mWindowHeight / 2) );
代码示例来源:origin: libgdx/libgdx
@Override
public void setCursorPosition(int x, int y) {
if(window.getConfig().hdpiMode == HdpiMode.Pixels) {
float xScale = window.getGraphics().getLogicalWidth() / (float)window.getGraphics().getBackBufferWidth();
float yScale = window.getGraphics().getLogicalHeight() / (float)window.getGraphics().getBackBufferHeight();
x = (int)(x * xScale);
y = (int)(y * yScale);
}
GLFW.glfwSetCursorPos(window.getWindowHandle(), x, y);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setCursorPosition(int x, int y) {
if(window.getConfig().hdpiMode == HdpiMode.Pixels) {
float xScale = window.getGraphics().getLogicalWidth() / (float)window.getGraphics().getBackBufferWidth();
float yScale = window.getGraphics().getLogicalHeight() / (float)window.getGraphics().getBackBufferHeight();
x = (int)(x * xScale);
y = (int)(y * yScale);
}
GLFW.glfwSetCursorPos(window.getWindowHandle(), x, y);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
org.lwjgl.glfw.GLFW.glfwSetCursorPos(window, origWidth / 2.0, origHeight / 2.0);
代码示例来源:origin: sriharshachilakapati/SilenceEngine
/**
* <p> This method sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the
* client area of the window. The window must have input focus. If the window does not have input focus when this
* method is called, it fails silently.</p>
*
* <p> <b>Do not use this method</b> to implement things like camera controls. GLFW already provides the
* {@code GLFW_CURSOR_DISABLED} cursor mode that hides the cursor, transparently re-centers it and provides
* unconstrained cursor motion. See {@link Window#setInputMode(int, int)} for more information.</p>
*
* <p> If the cursor mode is {@code GLFW_CURSOR_DISABLED} then the cursor position is unconstrained and limited
* only by the minimum and maximum values of a double.</p>
*
* @param xPos The desired x-coordinate, relative to the left edge of the client area.
* @param yPos The desired y-coordinate, relative to the top edge of the client area.
*/
public void setCursorPos(double xPos, double yPos)
{
glfwSetCursorPos(handle, xPos, yPos);
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void setPosition(final int x, final int y) {
GLFW.glfwSetCursorPos(_canvas.getWindowId(), x, y);
}
代码示例来源: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 void setCursorPosition(int x, int y) {
if(window.getConfig().hdpiMode == HdpiMode.Pixels) {
float xScale = window.getGraphics().getLogicalWidth() / (float)window.getGraphics().getBackBufferWidth();
float yScale = window.getGraphics().getLogicalHeight() / (float)window.getGraphics().getBackBufferHeight();
x = (int)(x * xScale);
y = (int)(y * yScale);
}
GLFW.glfwSetCursorPos(window.getWindowHandle(), x, y);
}
内容来源于网络,如有侵权,请联系作者删除!