Implement new jinput version 2.11

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago committed by GitHub
parent 94bf7406e6
commit 11bf992721
  1. BIN
      bin/RabiClone.jar
  2. BIN
      bin/controls.config
  3. BIN
      lib/bin/net/java/games/input/AWTEnvironmentPlugin.class
  4. BIN
      lib/bin/net/java/games/input/AWTKeyboard.class
  5. BIN
      lib/bin/net/java/games/input/AWTMouse.class
  6. BIN
      lib/bin/net/java/games/input/AbstractController.class
  7. BIN
      lib/bin/net/java/games/input/Controller.class
  8. BIN
      lib/bin/net/java/games/input/ControllerEnvironment.class
  9. BIN
      lib/bin/net/java/games/input/ControllerEvent.class
  10. BIN
      lib/bin/net/java/games/input/DIAbstractController.class
  11. BIN
      lib/bin/net/java/games/input/DIKeyboard.class
  12. BIN
      lib/bin/net/java/games/input/DIMouse.class
  13. BIN
      lib/bin/net/java/games/input/DefaultControllerEnvironment$4.class
  14. BIN
      lib/bin/net/java/games/input/DefaultControllerEnvironment.class
  15. BIN
      lib/bin/net/java/games/input/DirectAndRawInputEnvironmentPlugin.class
  16. BIN
      lib/bin/net/java/games/input/DirectInputEnvironmentPlugin.class
  17. BIN
      lib/bin/net/java/games/input/Keyboard.class
  18. BIN
      lib/bin/net/java/games/input/LinuxAbstractController.class
  19. BIN
      lib/bin/net/java/games/input/LinuxCombinedController.class
  20. BIN
      lib/bin/net/java/games/input/LinuxEnvironmentPlugin$1.class
  21. BIN
      lib/bin/net/java/games/input/LinuxEnvironmentPlugin$ShutdownHook.class
  22. BIN
      lib/bin/net/java/games/input/LinuxEnvironmentPlugin.class
  23. BIN
      lib/bin/net/java/games/input/LinuxJoystickAbstractController.class
  24. BIN
      lib/bin/net/java/games/input/LinuxKeyboard.class
  25. BIN
      lib/bin/net/java/games/input/LinuxMouse.class
  26. BIN
      lib/bin/net/java/games/input/Mouse.class
  27. BIN
      lib/bin/net/java/games/input/OSXAbstractController.class
  28. BIN
      lib/bin/net/java/games/input/OSXEnvironmentPlugin.class
  29. BIN
      lib/bin/net/java/games/input/OSXKeyboard.class
  30. BIN
      lib/bin/net/java/games/input/OSXMouse.class
  31. BIN
      lib/bin/net/java/games/input/RawDeviceInfo.class
  32. BIN
      lib/bin/net/java/games/input/RawHIDInfo.class
  33. BIN
      lib/bin/net/java/games/input/RawInputEnvironmentPlugin.class
  34. BIN
      lib/bin/net/java/games/input/RawKeyboard.class
  35. BIN
      lib/bin/net/java/games/input/RawKeyboardInfo.class
  36. BIN
      lib/bin/net/java/games/input/RawMouse.class
  37. BIN
      lib/bin/net/java/games/input/RawMouseInfo.class
  38. 4
      lib/bin/net/java/games/input/jinput.properties
  39. BIN
      lib/jinput.jar
  40. 34
      src/sig/RabiClone.java
  41. 61
      src/sig/objects/ConfigureControls.java

Binary file not shown.

Binary file not shown.

@ -1,2 +1,2 @@
version=2.10
date=13/05/2021
version=2.11
date=22/06/2022

Binary file not shown.

@ -2,6 +2,7 @@ package sig;
import javax.swing.JFrame;
import net.java.games.input.AbstractController;
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;
import net.java.games.input.ControllerEvent;
@ -30,7 +31,6 @@ import sig.engine.KeyBind;
import sig.engine.PaletteColor;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.RenderingHints;
public class RabiClone implements ControllerListener{
@ -67,7 +67,7 @@ public class RabiClone implements ControllerListener{
public static Player player;
public static Maps CURRENT_MAP;
public static Controller[] CONTROLLERS = new Controller[] {};
public static AbstractController[] CONTROLLERS = new AbstractController[] {};
public static long lastControllerScan = System.currentTimeMillis();
@ -77,26 +77,11 @@ public class RabiClone implements ControllerListener{
public static long TIME = 0;
public static long scaleTime;
public static boolean reloadControllerList = false;
public static HashMap<Action,List<KeyBind>> DEFAULT_KEYBINDS = new HashMap<>();
public static RenderingHints RENDERHINTS = new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
public static void main(String[] args) {
CONTROLLERS = ControllerEnvironment.getDefaultEnvironment().getControllers();
RabiClone r = new RabiClone();
ControllerEnvironment.getDefaultEnvironment().addControllerListener(r);
while (true) {
if (System.currentTimeMillis() - lastControllerScan > 5000) {
lastControllerScan=System.currentTimeMillis();
ControllerEnvironment.getDefaultEnvironment().rescanControllers();
}
}
/*System.setProperty("sun.java2d.transaccel", "True");
public static void main(String[] args) {System.setProperty("sun.java2d.transaccel", "True");
System.setProperty("sun.java2d.d3d", "True");
System.setProperty("sun.java2d.ddforcevram", "True");
System.setProperty("sun.java2d.xrender", "True");
@ -151,14 +136,9 @@ public class RabiClone implements ControllerListener{
KeyBind.poll();
if ((Key.isKeyHeld(KeyEvent.VK_F5)||reloadControllerList) && System.currentTimeMillis() - lastControllerScan > 5000) {
CONTROLLERS = ControllerEnvironment.getDefaultEnvironment().rescanControllers();
System.out.println(Arrays.toString(CONTROLLERS));
if (System.currentTimeMillis() - lastControllerScan > 5000) {
ControllerEnvironment.getDefaultEnvironment().rescanControllers();
lastControllerScan = System.currentTimeMillis();
if (reloadControllerList) {
ConfigureControls.LoadControls();
}
reloadControllerList=false;
}
FRIENDLY_OBJ.clear();
@ -192,7 +172,7 @@ public class RabiClone implements ControllerListener{
// System.out.println(TIME);
}
gameUpdateLoopStabilizer(dt); //This is hackish. Removing this slows down the game by about 30%. The timer runs slower. ???
}*/
}
}
public static void setupDefaultControls() {
@ -281,7 +261,7 @@ public class RabiClone implements ControllerListener{
ConfigureControls.updateHighlightSections();
}
}
Controller[] newArr = new Controller[CONTROLLERS.length - 1];
AbstractController[] newArr = new AbstractController[CONTROLLERS.length - 1];
for (int j = 0; j < CONTROLLERS.length; j++) {
if (j != i) {
newArr[(j > i ? j - 1 : j)] = CONTROLLERS[i];

@ -43,9 +43,6 @@ public class ConfigureControls extends Object{
public ConfigureControls(Panel panel) {
super(panel);
RabiClone.BACKGROUND_COLOR = PaletteColor.WHITE;
if (GAME_CONTROLS_FILE.exists()) {
RabiClone.reloadControllerList = true;
}
updateHighlightSections();
}
@ -204,41 +201,37 @@ public class ConfigureControls extends Object{
@Override
public void draw(byte[] p) {
if (!RabiClone.reloadControllerList) {
int y = 4;
if (!assigningKey) {
selectedAction=null;
selectedKeybind=null;
for (Action a : Action.values()) {
if (RabiClone.MOUSE_POS.getY()>=getY()+y&&RabiClone.MOUSE_POS.getY()<getY()+y+Font.PROFONT_12.getGlyphHeight()+4) {
selectedAction=a;
Draw_Rect(p,PaletteColor.PEACH,0,getY()+y,RabiClone.BASE_WIDTH,Font.PROFONT_12.getGlyphHeight()+4);
}
for (int i=0;i<actionHighlightSections.get(a.ordinal()).size();i+=2) {
List<Integer> sectionList = actionHighlightSections.get(a.ordinal());
int startX=sectionList.get(i)*Font.PROFONT_12.getGlyphWidth()-4;
int endX=sectionList.get(i+1)*Font.PROFONT_12.getGlyphWidth()+4;
if (selectedKeybind==null&&RabiClone.MOUSE_POS.getY()>=getY()+y&&RabiClone.MOUSE_POS.getY()<getY()+y+Font.PROFONT_12.getGlyphHeight()+4&&RabiClone.MOUSE_POS.getX()>=startX&&RabiClone.MOUSE_POS.getX()<=endX) {
Draw_Rect(p,PaletteColor.RED,startX,getY()+y,endX-startX,Font.PROFONT_12.getGlyphHeight()+4);
storedX=startX;
storedY=y;
storedEndX=endX;
selectedKeybind=KeyBind.KEYBINDS.get(a).get(i/2);
break;
}
}
Draw_Text_Ext(4,getY()+y,DisplayActionKeys(a),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.MIDNIGHT_BLUE);
y+=Font.PROFONT_12.getGlyphHeight()+4;
int y = 4;
if (!assigningKey) {
selectedAction=null;
selectedKeybind=null;
for (Action a : Action.values()) {
if (RabiClone.MOUSE_POS.getY()>=getY()+y&&RabiClone.MOUSE_POS.getY()<getY()+y+Font.PROFONT_12.getGlyphHeight()+4) {
selectedAction=a;
Draw_Rect(p,PaletteColor.PEACH,0,getY()+y,RabiClone.BASE_WIDTH,Font.PROFONT_12.getGlyphHeight()+4);
}
if (selectedKeybind!=null) {
Draw_Line(p,storedX,getY()+storedY,storedEndX,getY()+storedY+Font.PROFONT_12.getGlyphHeight()+4,PaletteColor.BLACK,Alpha.ALPHA32);
Draw_Line(p,storedX,getY()+storedY+Font.PROFONT_12.getGlyphHeight()+4,storedEndX,getY()+storedY,PaletteColor.BLACK,Alpha.ALPHA32);
for (int i=0;i<actionHighlightSections.get(a.ordinal()).size();i+=2) {
List<Integer> sectionList = actionHighlightSections.get(a.ordinal());
int startX=sectionList.get(i)*Font.PROFONT_12.getGlyphWidth()-4;
int endX=sectionList.get(i+1)*Font.PROFONT_12.getGlyphWidth()+4;
if (selectedKeybind==null&&RabiClone.MOUSE_POS.getY()>=getY()+y&&RabiClone.MOUSE_POS.getY()<getY()+y+Font.PROFONT_12.getGlyphHeight()+4&&RabiClone.MOUSE_POS.getX()>=startX&&RabiClone.MOUSE_POS.getX()<=endX) {
Draw_Rect(p,PaletteColor.RED,startX,getY()+y,endX-startX,Font.PROFONT_12.getGlyphHeight()+4);
storedX=startX;
storedY=y;
storedEndX=endX;
selectedKeybind=KeyBind.KEYBINDS.get(a).get(i/2);
break;
}
}
} else {
Draw_Text_Ext(4, 4, new String("Press a key to assign to ").append(selectedAction), Font.PROFONT_12, Alpha.ALPHA0, PaletteColor.MIDNIGHT_BLUE);
Draw_Text_Ext(4,getY()+y,DisplayActionKeys(a),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.MIDNIGHT_BLUE);
y+=Font.PROFONT_12.getGlyphHeight()+4;
}
if (selectedKeybind!=null) {
Draw_Line(p,storedX,getY()+storedY,storedEndX,getY()+storedY+Font.PROFONT_12.getGlyphHeight()+4,PaletteColor.BLACK,Alpha.ALPHA32);
Draw_Line(p,storedX,getY()+storedY+Font.PROFONT_12.getGlyphHeight()+4,storedEndX,getY()+storedY,PaletteColor.BLACK,Alpha.ALPHA32);
}
} else {
Draw_Text_Ext(4, 4, new String("Preparing controller list..."), Font.PROFONT_12, Alpha.ALPHA0, PaletteColor.MIDNIGHT_BLUE);
Draw_Text_Ext(4, 4, new String("Press a key to assign to ").append(selectedAction), Font.PROFONT_12, Alpha.ALPHA0, PaletteColor.MIDNIGHT_BLUE);
}
}

Loading…
Cancel
Save