Added Messages to Controller For Testing Purposes

- Added Pressed, Released, and Held Messages to Controller
#story[1006]
main
Fan-Wu Yang 9 years ago
parent d6d195f381
commit ec50310137

@ -24,18 +24,23 @@ public class InputChecker {
String codeString = event.getCode().toString(); String codeString = event.getCode().toString();
if (!currentlyActiveKeys.containsKey(codeString)) { if (!currentlyActiveKeys.containsKey(codeString)) {
ControlKey controlKey = KeyFactory.getKey(codeString); ControlKey controlKey = KeyFactory.getKey(codeString);
controlKey.onAction(); if (controlKey != null) {
controlKey.onAction();
System.out.println(controlKey.toString() + " is Pressed.");
}
currentlyActiveKeys.put(codeString, true); currentlyActiveKeys.put(codeString, true);
} }
}); });
scene.setOnKeyReleased(event -> { scene.setOnKeyReleased(event -> {
String codeString = event.getCode().toString(); String codeString = event.getCode().toString();
ControlKey controlKey = KeyFactory.getKey(codeString); ControlKey controlKey = KeyFactory.getKey(codeString);
controlKey.onRelease(); if (controlKey != null) {
currentlyActiveKeys.remove(event.getCode().toString()); controlKey.onRelease();
} System.out.println(controlKey.toString() + " is Released.");
); }
currentlyActiveKeys.remove(event.getCode().toString());
});
new AnimationTimer() { new AnimationTimer() {
@Override @Override
@ -44,7 +49,7 @@ public class InputChecker {
ControlKey controlKey = KeyFactory.getKey(key); ControlKey controlKey = KeyFactory.getKey(key);
if (controlKey != null){ if (controlKey != null){
controlKey.onHold(); controlKey.onHold();
System.out.println(controlKey.toString() + " is Pressed."); System.out.println(controlKey.toString() + " is Held.");
} }
} }
// for (String key : InputKeys.stringKeysMap.keySet()){ // for (String key : InputKeys.stringKeysMap.keySet()){

Loading…
Cancel
Save