public DoubleBuffer JITB$toDoubleBuffer() { final DoubleBuffer result = BufferUtils.createDoubleBuffer(16); JITB$toDoubleBuffer(result); return result; } }
/** * <p> This method returns the position of the cursor, in screen coordinates, relative to the upper-left corner of * the client area of the specified window.</p> * * <p> If the cursor is disabled (with {@code GLFW_CURSOR_DISABLED}) then the cursor position is unbounded and * limited only by the minimum and maximum values of a double.</p> * * @return The current position of the mouse cursor in screen coordinates, as a {@link Vector2} object. */ public Vector2 getCursorPos() { DoubleBuffer pos = BufferUtils.createDoubleBuffer(2); nglfwGetCursorPos(handle, memAddress(pos), memAddress(pos) + Double.BYTES); return new Vector2((float) pos.get(0), (float) pos.get(1)); }
public boolean onClick() { DoubleBuffer xPos = BufferUtils.createDoubleBuffer(1); DoubleBuffer yPos = BufferUtils.createDoubleBuffer(1); glfwGetCursorPos(BaseContext.getWindow().getId(), xPos, yPos); Vec2f mousePos = new Vec2f((float) xPos.get(),(float) yPos.get()); if(pos[0].getX() < mousePos.getX() && pos[1].getX() < mousePos.getX() && pos[2].getX() > mousePos.getX() && pos[3].getX() > mousePos.getX() && pos[0].getY() < BaseContext.getWindow().getHeight() - mousePos.getY() && pos[3].getY() < BaseContext.getWindow().getHeight() - mousePos.getY() && pos[1].getY() > BaseContext.getWindow().getHeight() - mousePos.getY() && pos[2].getY() > BaseContext.getWindow().getHeight() - mousePos.getY()) { return true; } else return false; }
DoubleBuffer xPos = BufferUtils.createDoubleBuffer(1); DoubleBuffer yPos = BufferUtils.createDoubleBuffer(1); glfwGetCursorPos(BaseContext.getWindow().getId(), xPos, yPos); Vec2f screenPos = new Vec2f((float) xPos.get(),(float) yPos.get());