Buttons van Wiimote geimplementeerd.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package pm.device.wiimote;
|
||||
|
||||
import pm.Button;
|
||||
import pm.exception.event.UnknownButtonException;
|
||||
|
||||
public enum WiimoteButton implements Button {
|
||||
TWO (0x0001),
|
||||
@@ -25,4 +26,13 @@ public enum WiimoteButton implements Button {
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static WiimoteButton create(int code) throws UnknownButtonException {
|
||||
for (WiimoteButton button : WiimoteButton.values()) {
|
||||
if (button.getCode() == code) {
|
||||
return button;
|
||||
}
|
||||
}
|
||||
throw new UnknownButtonException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user