Baggu fixed again

+Bonus document formatted
This commit is contained in:
FakeShemp
2016-03-09 22:11:17 +01:00
parent 42af029a26
commit 981dc3467e
+12 -3
View File
@@ -54,7 +54,9 @@ std::string TextPass::parseColors(std::string text, std::map<int, glm::vec4>& co
for (std::string::const_iterator c = parsedString.begin(); c != parsedString.end(); c++) {
if (*c == char(92)) { // Backlash
if ((c + 1) != parsedString.end()) {
if (*(c + 1) == char('C')) { // C for Color
if ((c + 7) != parsedString.end()) {
bool hasCorrectFormat = true;
for (std::string::const_iterator colorC = c + 2; colorC != c + 8; colorC++) {
@@ -82,8 +84,10 @@ std::string TextPass::parseColors(std::string text, std::map<int, glm::vec4>& co
parsedString.erase(c, (c + 8));
}
}
}
if (*(c + 1) == char('A')) { // A for Alpha
if ((c + 3) != parsedString.end()) {
bool hasCorrectFormat = true;
for (std::string::const_iterator colorC = c + 2; colorC != c + 4; colorC++) {
@@ -91,6 +95,7 @@ std::string TextPass::parseColors(std::string text, std::map<int, glm::vec4>& co
hasCorrectFormat = false;
break;
}
}
if (hasCorrectFormat == true) {
colorChange = true;
@@ -111,7 +116,8 @@ std::string TextPass::parseColors(std::string text, std::map<int, glm::vec4>& co
if ((*(c + 1) >= '1' && *(c + 1) <= '9') || *(c + 1) == 'B' || *(c + 1) == 'E' || *(c + 1) == 'F') { // Icons
if (*(c + 1) >= '1' && *(c + 1) <= '9') {
parsedString.replace(c, (c + 2), 1, (*(c + 1) - 48));
} else {
}
else {
parsedString.replace(c, (c + 2), 1, (*(c + 1) - 55));
}
}
@@ -121,6 +127,7 @@ std::string TextPass::parseColors(std::string text, std::map<int, glm::vec4>& co
}
}
}
}
@@ -145,9 +152,11 @@ void TextPass::renderText(std::string text, Font* font, TextJob::AlignmentEnum a
if (alignment == TextJob::AlignmentEnum::Center) {
penX = -stringWidth / 2.f;
} else if (alignment == TextJob::AlignmentEnum::Right) {
}
else if (alignment == TextJob::AlignmentEnum::Right) {
penX = -stringWidth;
} else {
}
else {
penX = 0;
}