mirror of
https://github.com/GTNewHorizons/lwjgl3ify.git
synced 2026-11-26 15:02:57 +00:00
Explicitly support up to 65k keys
This commit is contained in:
1 parent
742f9eb8c6
commit
da1a79b6b5
4 files changed
+28
-8
No files matched your search
@@ -6,9 +6,17 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
static final String javaVersion = "Java: " + System.getProperty("java.version");
|
||||
static final String javaVersion;
|
||||
static final String lwjglVersion = "LWJGL: " + org.lwjgl.Version.getVersion();
|
||||
|
||||
static {
|
||||
String javaVersionRaw = "Java: " + System.getProperty("java.version");
|
||||
if (javaVersionRaw.length() > 32) {
|
||||
javaVersionRaw = javaVersionRaw.substring(0, 29) + "...";
|
||||
}
|
||||
javaVersion = javaVersionRaw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerF3Handler() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
@@ -10,7 +10,13 @@ import org.spongepowered.asm.launch.GlobalProperties;
|
||||
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions({"org.lwjglx", "org.lwjgl", "me.eigenraven.lwjgl3ify.core"})
|
||||
@IFMLLoadingPlugin.TransformerExclusions({
|
||||
"org.lwjglx",
|
||||
"org.lwjgl",
|
||||
"org.lwjgl.input",
|
||||
"org.lwjglx.input",
|
||||
"me.eigenraven.lwjgl3ify.core"
|
||||
})
|
||||
@IFMLLoadingPlugin.SortingIndex(Integer.MAX_VALUE - 2)
|
||||
public class Lwjgl3ifyCoremod implements IFMLLoadingPlugin {
|
||||
|
||||
|
||||
@@ -274,6 +274,8 @@ public class KeyCodes {
|
||||
public static int toGlfwKey(int lwjglKeyCode) {
|
||||
|
||||
switch (lwjglKeyCode) {
|
||||
case Keyboard.KEY_NONE:
|
||||
return 0;
|
||||
case Keyboard.KEY_ESCAPE:
|
||||
return GLFW.GLFW_KEY_ESCAPE;
|
||||
case Keyboard.KEY_BACK:
|
||||
|
||||
@@ -183,12 +183,12 @@ public class Keyboard {
|
||||
}
|
||||
|
||||
private static long[] nanoTimeEvents = new long[queue.getMaxEvents()];
|
||||
private static char[] keyEventChars = new char[256];
|
||||
private static char[] keyEventChars = new char[Short.MAX_VALUE];
|
||||
|
||||
public static final int KEYBOARD_SIZE = 256;
|
||||
public static final int KEYBOARD_SIZE = Short.MAX_VALUE;
|
||||
|
||||
private static final String[] keyName = new String[KEYBOARD_SIZE];
|
||||
private static final Map<String, Integer> keyMap = new HashMap<>(253);
|
||||
private static final String[] keyName = new String[Short.MAX_VALUE];
|
||||
private static final Map<String, Integer> keyMap = new HashMap<>(Short.MAX_VALUE);
|
||||
|
||||
static {
|
||||
// Use reflection to find out key names
|
||||
@@ -203,17 +203,21 @@ public class Keyboard {
|
||||
&& field.getName().startsWith("KEY_")
|
||||
&& !field.getName().endsWith("WIN")) {
|
||||
/* Don't use deprecated names */
|
||||
|
||||
int key = field.getInt(null);
|
||||
String name = field.getName().substring(4);
|
||||
keyName[key] = name;
|
||||
keyMap.put(name, key);
|
||||
keyCounter++;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
keyCount = keyCounter;
|
||||
for (int i = 0; i < keyName.length; i++) {
|
||||
if (keyName[i] == null) {
|
||||
keyName[i] = "Key " + i;
|
||||
}
|
||||
keyMap.put(keyName[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addGlfwKeyEvent(long window, int key, int scancode, int action, int mods) {
|
||||
|
||||
Reference in new issue
Block a user