Fix Text Auto-Complete On Android

This commit is contained in:
TheBrokenRail 2023-11-05 15:23:40 -05:00 committed by iProgramInCpp
parent d4a100825b
commit 20790755d1
2 changed files with 13 additions and 8 deletions

View file

@ -138,6 +138,12 @@ static void handle_events()
break;
}
// Text Editing
if (event.key.keysym.sym == SDLK_BACKSPACE && event.key.state == SDL_PRESSED)
{
g_pApp->handleCharInput('\b');
}
// Normal Key Press
Keyboard::feed(AppPlatform_sdl_base::GetKeyState(event), TranslateSDLKeyCodeToVirtual(event.key.keysym.sym));
if (event.key.keysym.sym == SDLK_LSHIFT || event.key.keysym.sym == SDLK_RSHIFT)
@ -191,12 +197,16 @@ static void handle_events()
{
if (g_pApp != nullptr)
{
char x = event.text.text[0];
size_t length = strlen(event.text.text);
for (size_t i = 0; i < length; i++)
{
char x = event.text.text[i];
if (x >= ' ' && x <= '~')
{
g_pApp->handleCharInput(x);
}
}
}
break;
}
case SDL_WINDOWEVENT:

View file

@ -144,11 +144,6 @@ void TextInputBox::keyPressed(Minecraft* minecraft, int key)
case AKEYCODE_ARROW_RIGHT:
chr = '\003';
break;
#ifdef USE_SDL
case AKEYCODE_DEL:
chr = '\b';
break;
#endif
}
#endif