34 lines
711 B
Java
Executable File
34 lines
711 B
Java
Executable File
package projectzombie.input;
|
|
|
|
import org.lwjgl.glfw.GLFW;
|
|
import org.lwjgl.glfw.GLFWCursorPosCallbackI;
|
|
|
|
import projectzombie.Main;
|
|
import projectzombie.util.math.vec.Vec2d;
|
|
|
|
public class CursorPosCallback implements GLFWCursorPosCallbackI
|
|
{
|
|
@Override
|
|
public void invoke(long window, double x, double y)
|
|
{
|
|
Main.menu.input.mousePos(new Vec2d(x, y));
|
|
|
|
Main.window.setMouseVisibility(!Main.menu.keepMouse);
|
|
InputMode.Controller = false;
|
|
|
|
if(!Main.menu.keepMouse) {
|
|
return;
|
|
}
|
|
|
|
int wx = Main.window.getWidth();
|
|
int wy = Main.window.getHeight();
|
|
|
|
x = (x / wx - 0.5);
|
|
y = (y / wy - 0.5);
|
|
|
|
Main.menu.input.camera(true, x * 60);
|
|
GLFW.glfwSetCursorPos(window, wx / 2, wy / 2);
|
|
}
|
|
|
|
}
|