some code cleanup
commented code removed
This commit is contained in:
parent
f6fa7202d5
commit
b5acf03122
|
@ -466,37 +466,19 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput
|
||||||
if(isKeyPressed(SDLK_BACKSPACE,c) == true && text.length() > 0) {
|
if(isKeyPressed(SDLK_BACKSPACE,c) == true && text.length() > 0) {
|
||||||
//printf("BSPACE text [%s]\n",text.c_str());
|
//printf("BSPACE text [%s]\n",text.c_str());
|
||||||
|
|
||||||
/*
|
|
||||||
size_t found = text.find_last_of("_");
|
|
||||||
if (found == string::npos || found != text.length()-1) {
|
|
||||||
text.erase(text.end() - 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(text.size() > 1) {
|
|
||||||
text.erase(text.end() - 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool hasUnderscore = false;
|
bool hasUnderscore = false;
|
||||||
bool delChar = false;
|
bool delChar = false;
|
||||||
size_t found = text.find_last_of("_");
|
size_t found = text.find_last_of("_");
|
||||||
if (found == string::npos || found != text.length()-1) {
|
if (found == string::npos || found != text.length()-1) {
|
||||||
//printf("A text.length() = %d textCharLength.size() = %d\n",text.length(),textCharLength.size());
|
//printf("A text.length() = %d textCharLength.size() = %d\n",text.length(),textCharLength.size());
|
||||||
|
|
||||||
//if(textCharLength[textCharLength.size()-1] >= 1) {
|
|
||||||
if(activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1] >= 1) {
|
if(activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1] >= 1) {
|
||||||
//textCharLength[textCharLength.size()-1] = text.length();
|
|
||||||
delChar = true;
|
delChar = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//printf("B text.length() = %d textCharLength.size() = %d\n",text.length(),textCharLength.size());
|
//printf("B text.length() = %d textCharLength.size() = %d\n",text.length(),textCharLength.size());
|
||||||
|
|
||||||
hasUnderscore = true;
|
hasUnderscore = true;
|
||||||
//if(textCharLength.size() >= 2 && textCharLength[textCharLength.size()-2] >= 1) {
|
|
||||||
if(activeInputLabel->getTextCharLengthList().size() >= 2 && activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2] >= 1) {
|
if(activeInputLabel->getTextCharLengthList().size() >= 2 && activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2] >= 1) {
|
||||||
//textCharLength[textCharLength.size()-2] = text.length();
|
|
||||||
delChar = true;
|
delChar = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,34 +487,19 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput
|
||||||
//if(textCharLength.size() > 1) {
|
//if(textCharLength.size() > 1) {
|
||||||
if(activeInputLabel->getTextCharLengthList().size() > 1) {
|
if(activeInputLabel->getTextCharLengthList().size() > 1) {
|
||||||
//printf("Underscore erase start\n");
|
//printf("Underscore erase start\n");
|
||||||
//for(unsigned int i = 0; i < textCharLength.size(); ++i) {
|
|
||||||
// printf("len = %d [%d]\n",i,textCharLength[i]);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//for(unsigned int i = 0; i < textCharLength[textCharLength.size()-2]; ++i) {
|
|
||||||
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) {
|
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) {
|
||||||
//printf("erase A1 i = %d [%s]\n",i,text.c_str());
|
|
||||||
text.erase(text.end() -2);
|
text.erase(text.end() -2);
|
||||||
//printf("erase A2 i = %d [%s]\n",i,text.c_str());
|
|
||||||
}
|
}
|
||||||
//printf("AFTER DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length());
|
//printf("AFTER DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length());
|
||||||
//textCharLength.pop_back();
|
|
||||||
activeInputLabel->deleteTextCharLengthFromList();
|
activeInputLabel->deleteTextCharLengthFromList();
|
||||||
//textCharLength.pop_back();
|
|
||||||
activeInputLabel->deleteTextCharLengthFromList();
|
activeInputLabel->deleteTextCharLengthFromList();
|
||||||
//textCharLength.push_back(1);
|
|
||||||
activeInputLabel->addTextCharLengthToList(1);
|
activeInputLabel->addTextCharLengthToList(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//for(unsigned int i = 0; i < textCharLength[textCharLength.size()-1]; ++i) {
|
|
||||||
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) {
|
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) {
|
||||||
//printf("erase B1 i = %d [%s]\n",i,text.c_str());
|
|
||||||
text.erase(text.end() -1);
|
text.erase(text.end() -1);
|
||||||
//printf("erase B2 i = %d [%s]\n",i,text.c_str());
|
|
||||||
}
|
}
|
||||||
//printf("AFTER DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length());
|
|
||||||
//textCharLength.pop_back();
|
|
||||||
activeInputLabel->deleteTextCharLengthFromList();
|
activeInputLabel->deleteTextCharLengthFromList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user