So I have 2 text fields for a username and password.
All works as expected, however…how the hell do I detect when the backspace key is pressed? Is there a character ID/unicode for this?
Atm I have this:
username = new TextField("", style);
username.setTextFieldListener(new TextFieldListener() {
@Override
public void keyTyped(TextField textField, char c) {
usernameString.append(Character.toUpperCase(c));
textField.setText(usernameString.toString());
}
});
I am using a Stringbuilder for it, basically when backspace is entered I want to delete the character at the last index of the string. Any ideas?
Surely I don’t have to run a separate check for this? As in:
Gdx.input.isKeyPressed(Keys.BACKSPACE);