Gekke door elkaar lopende versie gefixt.
This commit is contained in:
@@ -52,10 +52,10 @@ public class Main {
|
|||||||
|
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
//add(new ExampleDevice());
|
//add(new ExampleDevice());
|
||||||
add(new RumblepadDevice());
|
//add(new RumblepadDevice());
|
||||||
//add(new Extreme3DDevice());
|
//add(new Extreme3DDevice());
|
||||||
add(new JIntellitypeDevice());
|
add(new JIntellitypeDevice());
|
||||||
add(new WiimoteDevice());
|
//add(new WiimoteDevice());
|
||||||
for (Device device : deviceList) {
|
for (Device device : deviceList) {
|
||||||
device.start();
|
device.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,49 +2,41 @@ package pm.device.javainput.rumblepad;
|
|||||||
|
|
||||||
import de.hardcode.jxinput.event.JXInputButtonEvent;
|
import de.hardcode.jxinput.event.JXInputButtonEvent;
|
||||||
import pm.Button;
|
import pm.Button;
|
||||||
import pm.device.javainput.JavaInputButton;
|
import pm.device.javainput.extreme3d.Extreme3DButton;
|
||||||
import pm.exception.event.UnknownButtonException;
|
import pm.exception.event.UnknownButtonException;
|
||||||
|
|
||||||
public enum RumblepadButton implements Button {
|
public enum RumblepadButton implements Button {
|
||||||
ONE (0),
|
ONE ("Button 0"),
|
||||||
TWO (1),
|
TWO ("Button 1"),
|
||||||
THREE (2),
|
THREE ("Button 2"),
|
||||||
FOUR (3),
|
FOUR ("Button 3"),
|
||||||
FIVE (4),
|
FIVE ("Button 4"),
|
||||||
SIX (5),
|
SIX ("Button 5"),
|
||||||
SEVEN (6),
|
SEVEN ("Button 6"),
|
||||||
EIGHT (7),
|
EIGHT ("Button 7"),
|
||||||
NINE (8),
|
NINE ("Button 8"),
|
||||||
TEN (9);
|
TEN ("Button 9");
|
||||||
|
|
||||||
protected int code;
|
protected String code;
|
||||||
|
|
||||||
private RumblepadButton(int code) {
|
private RumblepadButton(String code) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JavaInputButton create(int code) throws UnknownButtonException {
|
public static RumblepadButton create(String code) throws UnknownButtonException {
|
||||||
for (RumblepadButton button : RumblepadButton.values()) {
|
for (RumblepadButton button : RumblepadButton.values()) {
|
||||||
if (button.getCode() == code) {
|
if (button.getCode().equals(code)) {
|
||||||
return new JavaInputButton(code + 1);
|
return button;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new UnknownButtonException();
|
throw new UnknownButtonException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JavaInputButton create(JXInputButtonEvent event) throws UnknownButtonException {
|
public static RumblepadButton create(JXInputButtonEvent event) throws UnknownButtonException {
|
||||||
String name = event.getButton().getName();
|
return create(event.getButton().getName());
|
||||||
String button = name.replaceFirst("Button ", "");
|
|
||||||
int code = Integer.valueOf(button);
|
|
||||||
//System.out.println(name + " " + button + " " + code);
|
|
||||||
return create(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return String.valueOf(getCode());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ import pm.Button;
|
|||||||
import pm.Macro;
|
import pm.Macro;
|
||||||
import pm.Target;
|
import pm.Target;
|
||||||
import pm.device.javainput.EightfoldDirection;
|
import pm.device.javainput.EightfoldDirection;
|
||||||
import pm.device.javainput.JavaInputButton;
|
|
||||||
import pm.device.javainput.JavaInputDevice;
|
import pm.device.javainput.JavaInputDevice;
|
||||||
import pm.exception.DeviceException;
|
import pm.exception.DeviceException;
|
||||||
import pm.exception.MacroException;
|
import pm.exception.MacroException;
|
||||||
@@ -36,7 +35,7 @@ public class RumblepadDevice extends JavaInputDevice {
|
|||||||
new Press(RumblepadButton.THREE),
|
new Press(RumblepadButton.THREE),
|
||||||
Action.RESUME.setTarget(Target.APPLICATION));
|
Action.RESUME.setTarget(Target.APPLICATION));
|
||||||
add(
|
add(
|
||||||
new Press(new JavaInputButton(9)),
|
new Press(RumblepadButton.NINE),
|
||||||
Action.EXIT.setTarget(Target.MAIN));
|
Action.EXIT.setTarget(Target.MAIN));
|
||||||
} catch (MacroException e) {
|
} catch (MacroException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user