The progress which I did.

I continue later.
This commit is contained in:
VoltZ
2019-11-11 19:43:00 +01:00
parent 955b644ad4
commit 67694a5f96
9 changed files with 311 additions and 20 deletions
+21
View File
@@ -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 "";
}
}