/** * convert the given KeyboardInputEvent into a neutralized NiftyInputEvent. * * @param inputEvent input event * @return NiftInputEvent */ public NiftyInputEvent convert(final KeyboardInputEvent inputEvent) { if (inputEvent.isKeyDown()) { return handleKeyDownEvent(inputEvent); } else { return handleKeyUpEvent(inputEvent); } }
public NiftyInputEvent convert(final KeyboardInputEvent inputEvent) { if (inputEvent.isKeyDown()) { if (inputEvent.getKey() == KeyboardInputEvent.KEY_F1) { return NiftyInputEvent.ConsoleToggle; } else if (inputEvent.getKey() == KeyboardInputEvent.KEY_RETURN) { return NiftyInputEvent.Activate; } else if (inputEvent.getKey() == KeyboardInputEvent.KEY_SPACE) { return NiftyInputEvent.Activate; } else if (inputEvent.getKey() == KeyboardInputEvent.KEY_TAB) { if (inputEvent.isShiftDown()) { return NiftyInputEvent.PrevInputElement; } else { return NiftyInputEvent.NextInputElement; } } else if (inputEvent.getKey() == KeyboardInputEvent.KEY_UP) { return NiftyInputEvent.MoveCursorUp; } else if (inputEvent.getKey() == KeyboardInputEvent.KEY_DOWN) { return NiftyInputEvent.MoveCursorDown; } } return null; }