Watch for events while configuring controls.

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent a117fbdb2a
commit 9060e3aa96
  1. 22
      src/sig/objects/ConfigureControls.java

@ -1,8 +1,7 @@
package sig.objects;
import java.util.HashMap;
import net.java.games.input.Component;
import net.java.games.input.Event;
import sig.RabiClone;
import sig.engine.Action;
import sig.engine.Alpha;
@ -14,8 +13,6 @@ import sig.engine.Panel;
public class ConfigureControls extends Object{
HashMap<Component,Float> defaultValues = new HashMap<>();
protected ConfigureControls(Panel panel) {
super(panel);
RabiClone.BACKGROUND_COLOR = PaletteColor.WHITE;
@ -23,8 +20,21 @@ public class ConfigureControls extends Object{
@Override
public void update(double updateMult) {
// TODO Auto-generated method stub
Event e = new Event();
for (int i=0;i<RabiClone.CONTROLLERS.length;i++) {
if (RabiClone.CONTROLLERS[i].poll()) {
Component[] components = RabiClone.CONTROLLERS[i].getComponents();
for (int j=0;j<components.length;j++) {
//Component c = components[j];
//System.out.println(c.getName()+","+c.getIdentifier()+": "+c.getPollData());
}
//System.out.println("--------");
if (RabiClone.CONTROLLERS[i].getEventQueue().getNextEvent(e)) {
System.out.println(e.getComponent().getName()+" value: "+e.getValue());
}
}
}
}
@Override

Loading…
Cancel
Save