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