Toggle Android text input when invoking console
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <SDL_screenkeyboard.h>
|
||||
#endif
|
||||
|
||||
static const uint ICON_HISTORY_SIZE = 20;
|
||||
static const uint ICON_LINE_SPACING = 2;
|
||||
static const uint ICON_RIGHT_BORDERWIDTH = 10;
|
||||
@@ -447,9 +451,25 @@ void IConsoleSwitch()
|
||||
{
|
||||
switch (_iconsole_mode) {
|
||||
case ICONSOLE_CLOSED:
|
||||
new IConsoleWindow();
|
||||
#ifdef __ANDROID__
|
||||
{
|
||||
char buf[1024] = "";
|
||||
for (const IConsoleLine *print = IConsoleLine::Get(0); print != NULL; print = print->previous) {
|
||||
if (print->buffer && print->buffer[0]) {
|
||||
strncat(buf, print->buffer, sizeof(buf)-strlen(buf)-1);
|
||||
strncat(buf, "\n", sizeof(buf)-strlen(buf)-1);
|
||||
}
|
||||
}
|
||||
strncat(buf, "\n\n\n\n\n\n\n\n", sizeof(buf)-strlen(buf)-1); // Move all text to top
|
||||
SDL_ANDROID_SetScreenKeyboardHintMesage(buf);
|
||||
char text[512] = "";
|
||||
SDL_ANDROID_GetScreenKeyboardTextInput(text, sizeof(text) - 1); /* Invoke Android built-in screen keyboard */
|
||||
IConsoleCmdExec(text);
|
||||
}
|
||||
#else
|
||||
new IConsoleWindow();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ICONSOLE_OPENED: case ICONSOLE_FULL:
|
||||
DeleteWindowById(WC_CONSOLE, 0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user