FIX: char '1' work like backspace on android
This commit is contained in:
@@ -61,6 +61,12 @@ bool Screen::handleBackEvent( bool isDown )
|
||||
return false;
|
||||
}
|
||||
|
||||
void Screen::tick() {
|
||||
for (auto& textbox : textBoxes) {
|
||||
textbox->tick(minecraft);
|
||||
}
|
||||
}
|
||||
|
||||
void Screen::updateEvents()
|
||||
{
|
||||
if (passEvents)
|
||||
@@ -110,10 +116,12 @@ void Screen::keyboardEvent()
|
||||
keyPressed(Keyboard::getEventKey());
|
||||
}
|
||||
}
|
||||
|
||||
void Screen::keyboardTextEvent()
|
||||
{
|
||||
charPressed(Keyboard::getChar());
|
||||
}
|
||||
|
||||
void Screen::renderBackground()
|
||||
{
|
||||
renderBackground(0);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
virtual void keyboardTextEvent();
|
||||
virtual bool handleBackEvent(bool isDown);
|
||||
|
||||
virtual void tick() {}
|
||||
virtual void tick();
|
||||
|
||||
virtual void removed() {}
|
||||
|
||||
|
||||
@@ -220,16 +220,23 @@ static int androidKeyToInternal(int androidKey) {
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mojang_minecraftpe_MainActivity_nativeOnKeyDown(JNIEnv* env, jclass cls, jint keyCode) {
|
||||
LOGI("@nativeOnKeyDown: %d\n", keyCode);
|
||||
|
||||
// @rewrite
|
||||
|
||||
if (keyCode != AKEYCODE_1) {
|
||||
int mapped = androidKeyToInternal(keyCode);
|
||||
Keyboard::feed(mapped, true);
|
||||
}
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mojang_minecraftpe_MainActivity_nativeTextChar(JNIEnv* env, jclass cls, jint unicodeChar) {
|
||||
LOGI("@nativeTextChar: %d '%c'", unicodeChar, (char)unicodeChar);
|
||||
// soft-keyboards may send a backspace as a character code
|
||||
if (unicodeChar == 8) {
|
||||
// Kolyah35: i dont believe :v
|
||||
/*if (unicodeChar == 8) {
|
||||
Keyboard::feed(Keyboard::KEY_BACKSPACE, true);
|
||||
Keyboard::feed(Keyboard::KEY_BACKSPACE, false);
|
||||
} else if (unicodeChar > 0 && unicodeChar < 128) {
|
||||
} else*/ if (unicodeChar > 0 && unicodeChar < 128) {
|
||||
Keyboard::feedText((char)unicodeChar);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user