Add missing Mouse functions

This commit is contained in:
Raven Szewczyk committed 2023-01-25 20:10:51 +00:00
1 parent 996cec491a
commit ec3cef240c
2 files changed
+38 -37

No files matched your search

+34 -2
View File
@@ -2,6 +2,7 @@ package org.lwjglx.input;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.BufferUtils;
import org.lwjgl.glfw.GLFW;
import org.lwjglx.LWJGLException;
@@ -213,10 +214,41 @@ public class Mouse {
}
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
// TODO
System.out.println("TODO: Implement Mouse.setNativeCursor(Cursor)");
// no-op
return null;
}
public static void destroy() {}
public static int getButtonIndex(String buttonName) {
if (buttonName.matches("BUTTON[0-9]+")) {
return Integer.parseInt(StringUtils.removeStart(buttonName, "BUTTON"));
} else {
return -1;
}
}
public static String getButtonName(int button) {
return "BUTTON" + button;
}
public static Cursor getNativeCursor() {
return null;
}
public static boolean hasWheel() {
return true;
}
public static boolean isClipMouseCoordinatesToWindow() {
return clipPostionToDisplay;
}
public static boolean isInsideWindow() {
return Display.isVisible();
}
public static void updateCursor() {
// no-op
}
}
+4 -35
View File
@@ -21,7 +21,6 @@ import org.lwjgl.glfw.GLFWWindowPosCallback;
import org.lwjgl.glfw.GLFWWindowRefreshCallback;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.system.libffi.FFICIF;
import org.lwjglx.BufferUtils;
import org.lwjglx.Sys;
import org.lwjglx.input.Keyboard;
@@ -164,45 +163,15 @@ public class Display {
Window.windowFocusCallback = new GLFWWindowFocusCallback() {
@Override
public void close() {
super.close();
}
@Override
public FFICIF getCallInterface() {
return super.getCallInterface();
}
@Override
public void callback(long ret, long args) {
super.callback(ret, args);
}
@Override
public void invoke(long l, boolean b) {
displayFocused = b == true;
public void invoke(long window, boolean focused) {
displayFocused = focused == true;
}
};
Window.windowIconifyCallback = new GLFWWindowIconifyCallback() {
@Override
public void close() {
super.close();
}
@Override
public FFICIF getCallInterface() {
return super.getCallInterface();
}
@Override
public void callback(long ret, long args) {
super.callback(ret, args);
}
@Override
public void invoke(long l, boolean b) {
displayVisible = b == false;
public void invoke(long window, boolean iconified) {
displayVisible = iconified == false;
}
};