Fix overwriting presses and releases
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
7387ced9e5
commit
e05a25fc80
@ -79,23 +79,21 @@ public class KeyBind {
|
|||||||
//Polls all KeyBinds based on device.
|
//Polls all KeyBinds based on device.
|
||||||
for (Action a : Action.values()) {
|
for (Action a : Action.values()) {
|
||||||
boolean held = false;
|
boolean held = false;
|
||||||
KeyBind cc = null;
|
|
||||||
for (KeyBind c : KEYBINDS.get(a)) {
|
for (KeyBind c : KEYBINDS.get(a)) {
|
||||||
held = c.isKeyHeld();
|
held = c.isKeyHeld();
|
||||||
actionEventCheck(a,held);
|
|
||||||
if (held) {
|
if (held) {
|
||||||
cc=c;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (held) {
|
actionEventCheck(a,held);
|
||||||
|
/*if (held) {
|
||||||
if (KEYBINDS.get(a).get(0)!=cc) {
|
if (KEYBINDS.get(a).get(0)!=cc) {
|
||||||
for (int i=0;i<KEYBINDS.get(a).size()-1;i++) {
|
for (int i=0;i<KEYBINDS.get(a).size()-1;i++) {
|
||||||
KEYBINDS.get(a).set(i+1,KEYBINDS.get(a).get(i));
|
KEYBINDS.get(a).set(i+1,KEYBINDS.get(a).get(i));
|
||||||
}
|
}
|
||||||
KEYBINDS.get(a).set(0,cc);
|
KEYBINDS.get(a).set(0,cc);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.java.games.input.Component;
|
import net.java.games.input.Component;
|
||||||
import net.java.games.input.Event;
|
import net.java.games.input.Event;
|
||||||
|
import net.java.games.input.Component.Identifier;
|
||||||
|
import net.java.games.input.Component.POV;
|
||||||
import sig.RabiClone;
|
import sig.RabiClone;
|
||||||
import sig.engine.Action;
|
import sig.engine.Action;
|
||||||
import sig.engine.Alpha;
|
import sig.engine.Alpha;
|
||||||
@ -35,10 +37,19 @@ public class ConfigureControls extends Object{
|
|||||||
//System.out.println(c.getName()+","+c.getIdentifier()+": "+c.getPollData());
|
//System.out.println(c.getName()+","+c.getIdentifier()+": "+c.getPollData());
|
||||||
}
|
}
|
||||||
//System.out.println("--------");
|
//System.out.println("--------");
|
||||||
if (RabiClone.CONTROLLERS[i].getEventQueue().getNextEvent(e)) {
|
while (RabiClone.CONTROLLERS[i].getEventQueue().getNextEvent(e)) {
|
||||||
if (assigningKey) {
|
if (assigningKey) {
|
||||||
List<KeyBind> clist = KeyBind.KEYBINDS.get(selectedAction);
|
List<KeyBind> clist = KeyBind.KEYBINDS.get(selectedAction);
|
||||||
clist.add(new KeyBind(RabiClone.CONTROLLERS[i],e.getComponent().getIdentifier(),e.getValue()));
|
Identifier id = e.getComponent().getIdentifier();
|
||||||
|
if (id==Identifier.Axis.POV) {
|
||||||
|
if (e.getValue()!=POV.DOWN&&
|
||||||
|
e.getValue()!=POV.RIGHT&&
|
||||||
|
e.getValue()!=POV.LEFT&&
|
||||||
|
e.getValue()!=POV.UP) {
|
||||||
|
continue; //Can't add ordinal directions, only cardinal.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clist.add(new KeyBind(RabiClone.CONTROLLERS[i],id,e.getValue()));
|
||||||
KeyBind.KEYBINDS.put(selectedAction,clist);
|
KeyBind.KEYBINDS.put(selectedAction,clist);
|
||||||
assigningKey=false;
|
assigningKey=false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user