Buttons van Wiimote geimplementeerd.

This commit is contained in:
2011-02-13 20:41:30 +00:00
parent 7fe13d454b
commit b0e2b09487
5 changed files with 66 additions and 17 deletions

View File

@@ -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();
}
}