Skip to content
Permalink
ccf5f5084b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (24 sloc) 575 Bytes
package game.input;
import static org.lwjgl.glfw.GLFW.*;
import org.lwjgl.glfw.GLFWCursorPosCallback;
public class Mouse extends GLFWCursorPosCallback {
private double xPos, yPos;
private long window;
public Mouse(long window) {
this.window = window;
}
@Override
public void invoke(long window, double xPos, double yPos) {
this.xPos = xPos;
this.yPos = yPos;
}
public double getX() {
return xPos;
}
public double getY() {
return yPos;
}
public boolean leftClicked() {
return (1 == glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_1));
}
}