Add mobile keyboard support (#206)

This commit is contained in:
Alexander Batalov 2022-12-08 20:41:59 +03:00 committed by GitHub
parent 4b03c714b4
commit c383fc6b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 0 deletions

View File

@ -1931,6 +1931,8 @@ static int _get_input_str(int win, int cancelKeyCode, char* text, int maxLength,
windowRefresh(win);
beginTextInput();
int blinkingCounter = 3;
bool blink = false;
@ -1994,6 +1996,8 @@ static int _get_input_str(int win, int cancelKeyCode, char* text, int maxLength,
sharedFpsLimiter.throttle();
}
endTextInput();
if (rc == 0 || nameLength > 0) {
copy[nameLength] = '\0';
strcpy(text, copy);

View File

@ -1089,6 +1089,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
windowRefresh(win);
beginTextInput();
int blinkingCounter = 3;
bool blink = false;
@ -1353,6 +1355,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
sharedFpsLimiter.throttle();
}
endTextInput();
if (rc == 0) {
if (fileNameCopyLength != 0) {
fileNameCopy[fileNameCopyLength] = '\0';

View File

@ -1209,4 +1209,14 @@ static void idleImpl()
SDL_Delay(125);
}
void beginTextInput()
{
SDL_StartTextInput();
}
void endTextInput()
{
SDL_StopTextInput();
}
} // namespace fallout

View File

@ -44,6 +44,9 @@ void _GNW95_process_message();
void _GNW95_clear_time_stamps();
void _GNW95_lost_focus();
void beginTextInput();
void endTextInput();
} // namespace fallout
#endif /* FALLOUT_INPUT_H_ */

View File

@ -2213,6 +2213,8 @@ static int _get_input_str2(int win, int doneKeyCode, int cancelKeyCode, char* de
windowRefresh(win);
renderPresent();
beginTextInput();
int blinkCounter = 3;
bool blink = false;
@ -2282,6 +2284,8 @@ static int _get_input_str2(int win, int doneKeyCode, int cancelKeyCode, char* de
sharedFpsLimiter.throttle();
}
endTextInput();
if (rc == 0) {
text[textLength] = '\0';
strcpy(description, text);