flare-engine
flare-engine copied to clipboard
About the input of hero's name
At New Game, in the input of the name, it seems that the player can only enter Englisf letters. In other words, the player can not input Japanese or Chinese etc. We should tell the player that the input is limited to English letters.
As a another topic , the number of the inputable letter seems to be infinite, but I think that it should limit the number of letters. I think that it is enough for 20 letters or less. At longest, it should not exceed 40 letters.
It is possible to type and input in Japanese mode even if to press Japanese letters at the time of the name's input, but Japanese letters are not displayed on the input screen of the name. Internally on flare, the name string of Japanese seems to be accepting.
Since name entry in Japanese may cause bugs, we should call the player not to type in Japanese.
Ideally, we're supposed to be checking for SDL_TEXTEDITING
events for reading such input. However, I can't get any events to trigger with IBus + Anthy.
Where cpp has a program for entering the name of this NewGame? Please teach me the file name.
There's two components:
-
src/SDLInputState.cpp
: this is where all the SDL-specific stuff is -
src/WidgetInput.cpp
: this is the GUI widget for enter text. It makes several calls to SDLInputState
SDLInputState.cpp
// grab symbol keys
if (event.type == SDL_TEXTEDITING) {
inkeys += event.edit.text;
}
if (event.type == SDL_TEXTINPUT) {
inkeys += event.text.text;
}
When I wrote the code like this, I could enter Jaoanese. However, there is many bugs in this code, and in the input after the second character, characters that you entered that you entered last time will be added.
By the way, about kanji' input-candidates, It seems that the OS side is in charge of displaying character candidates for conversion to kanji. While my inputting some letters, conversion candidates for kanji are displayed automatically.
What is the meaning of "inkeys"? Is it input_keys? It may be that we need a new variable like "edit_strings".