Refactored KeyFactory to ensure single instance of each key state handler.

#story[1089]
This commit is contained in:
Connor Taylor-Brown
2017-07-26 23:22:05 +12:00
parent cc264f318e
commit 86e8cb7560
11 changed files with 63 additions and 63 deletions
@@ -92,10 +92,12 @@ public class RaceController extends Controller {
@Override
public void initialize(URL location, ResourceBundle resources) {
KeyFactory keyFactory = KeyFactory.getFactory();
// Initialise keyboard handler
race.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
String codeString = event.getCode().toString();
ControlKey controlKey = KeyFactory.getKey(codeString);
ControlKey controlKey = keyFactory.getKey(codeString);
if(controlKey != null) {
try {
controllerClient.sendKey(controlKey);