mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 08:39:05 +00:00
The progress which I did.
I continue later.
This commit is contained in:
@@ -149,4 +149,25 @@ int Input::getUint(int max, std::string Text) {
|
||||
int i = atoi(s.c_str());
|
||||
if(i>max) return 255;
|
||||
return i;
|
||||
}
|
||||
|
||||
std::string Input::getString(const std::string &hint, uint maxLength)
|
||||
{
|
||||
std::string string;
|
||||
C3D_FrameEnd(0);
|
||||
SwkbdState state;
|
||||
const char *hintText = hint.c_str();
|
||||
swkbdInit(&state, SWKBD_TYPE_NORMAL, 2, maxLength);
|
||||
swkbdSetHintText(&state, hintText);
|
||||
swkbdSetValidation(&state, SWKBD_NOTBLANK_NOTEMPTY, SWKBD_FILTER_PROFANITY, 0);
|
||||
char input[maxLength + 1] = {0};
|
||||
SwkbdButton ret = swkbdInputText(&state, input, sizeof(input));
|
||||
input[maxLength] = '\0';
|
||||
if (ret == SWKBD_BUTTON_CONFIRM)
|
||||
{
|
||||
string = input;
|
||||
return string;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user