嗨我困住了一个问题,我似乎无法解决关于TextField for libgdx。我想忽略某些字符,例如在使用“shift”作为大写字符时,不要在文本字段中写入空格。目前我已经写过这样的内容。制作libgdx文本字段会忽略某些字符?
accField.setTextFieldListener(new TextFieldListener() {
public void keyTyped(TextField textField, char c) {
if (c == 'a') {
//Something here that does the replacement maybe?
}
}
});
你见过Textfield.TextfieldFilter吗?这是你想要的? – Springrbua
这看起来很有趣..我怎么才能以一种好的方式实现它? – Lucas
我写了一个答案。希望它可以帮助你。但我从来没有尝试过。请告诉我,如果这是错误的,纠正我,因为我也想用我的游戏过滤器:P – Springrbua