Refactored KeyFactory to ensure single instance of each key state handler.
#story[1089]
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user