@Override public void update() { for (Integer id : keysPressed.keySet().toArray(new Integer[keysPressed.size()])) { KeyState prev = keysPressed.get(id); switch (prev) { case DOWN: keysPressed.put(id, KeyState.HELD); break; case RELEASED: keysPressed.remove(id); break; case CLICK: keysPressed.put(id, KeyState.RELEASED); break; } } lastMousePosition = mousePosition.clone(); }
public static Vector getMouseDelta() { return Vector.difference(lastMousePosition, mousePosition) .multiply(Camera.main().deltatime()) .clone(); }
public static Vector getMousePosition() { return mousePosition.clone(); }