Baggu fixed again
+Bonus document formatted
This commit is contained in:
@@ -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++) {
|
for (std::string::const_iterator c = parsedString.begin(); c != parsedString.end(); c++) {
|
||||||
if (*c == char(92)) { // Backlash
|
if (*c == char(92)) { // Backlash
|
||||||
|
if ((c + 1) != parsedString.end()) {
|
||||||
if (*(c + 1) == char('C')) { // C for Color
|
if (*(c + 1) == char('C')) { // C for Color
|
||||||
|
if ((c + 7) != parsedString.end()) {
|
||||||
bool hasCorrectFormat = true;
|
bool hasCorrectFormat = true;
|
||||||
|
|
||||||
for (std::string::const_iterator colorC = c + 2; colorC != c + 8; colorC++) {
|
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));
|
parsedString.erase(c, (c + 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*(c + 1) == char('A')) { // A for Alpha
|
if (*(c + 1) == char('A')) { // A for Alpha
|
||||||
|
if ((c + 3) != parsedString.end()) {
|
||||||
bool hasCorrectFormat = true;
|
bool hasCorrectFormat = true;
|
||||||
|
|
||||||
for (std::string::const_iterator colorC = c + 2; colorC != c + 4; colorC++) {
|
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;
|
hasCorrectFormat = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasCorrectFormat == true) {
|
if (hasCorrectFormat == true) {
|
||||||
colorChange = 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') || *(c + 1) == 'B' || *(c + 1) == 'E' || *(c + 1) == 'F') { // Icons
|
||||||
if (*(c + 1) >= '1' && *(c + 1) <= '9') {
|
if (*(c + 1) >= '1' && *(c + 1) <= '9') {
|
||||||
parsedString.replace(c, (c + 2), 1, (*(c + 1) - 48));
|
parsedString.replace(c, (c + 2), 1, (*(c + 1) - 48));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
parsedString.replace(c, (c + 2), 1, (*(c + 1) - 55));
|
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) {
|
if (alignment == TextJob::AlignmentEnum::Center) {
|
||||||
penX = -stringWidth / 2.f;
|
penX = -stringWidth / 2.f;
|
||||||
} else if (alignment == TextJob::AlignmentEnum::Right) {
|
}
|
||||||
|
else if (alignment == TextJob::AlignmentEnum::Right) {
|
||||||
penX = -stringWidth;
|
penX = -stringWidth;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
penX = 0;
|
penX = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user