- tomreyn broken the intro text centering but adding empty intro text properties, so i commented the properties out

- added more info / safer logic to center text
This commit is contained in:
Mark Vejvoda 2012-07-26 06:47:59 +00:00
parent 6662f35347
commit 8d6cdfb5db
2 changed files with 17 additions and 7 deletions

View File

@ -499,6 +499,8 @@ Intro::Intro(Program *program):
string introVideoFile = CoreData::getInstance().getIntroVideoFilename();
string introVideoFileFallback = CoreData::getInstance().getIntroVideoFilenameFallback();
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Intro Video [%s] [%s]\n",introVideoFile.c_str(),introVideoFileFallback.c_str());
//renderer.clearBuffers();
//renderer.reset3dMenu();
//renderer.clearZBuffer();

View File

@ -121,13 +121,21 @@ Text * FontMetrics::getTextHandler() {
float FontMetrics::getTextWidth(const string &str) {
string longestLine = "";
vector<string> lineTokens;
Tokenize(str,lineTokens,"\n");
for(unsigned int i = 0; i < lineTokens.size(); ++i) {
string currentStr = lineTokens[i];
if(currentStr.length() > longestLine.length()) {
longestLine = currentStr;
}
size_t found = str.find("\n");
if (found == string::npos) {
longestLine = str;
}
else {
vector<string> lineTokens;
Tokenize(str,lineTokens,"\n");
if(lineTokens.size() > 0) {
for(unsigned int i = 0; i < lineTokens.size(); ++i) {
string currentStr = lineTokens[i];
if(currentStr.length() > longestLine.length()) {
longestLine = currentStr;
}
}
}
}
if(textHandler != NULL) {