else
bonus_name = "Excellent!"; // When does this happen?
- glColor4f(0, 0, 0, 1 - bonustime);
- text->glPrintOutline(1024 / 2 - 10 * strlen(bonus_name) - 4, 768 / 16 - 4 + 768 * 4 / 5, bonus_name, 1, 2.5, 1024, 768);
- glColor4f(1, 0, 0, 1 - bonustime);
- text->glPrint(1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
string = to_string((int)bonusvalue);
- glColor4f(0, 0, 0, 1 - bonustime);
- text->glPrintOutline(1024 / 2 - 10 * string.size() - 4, 768 / 16 - 4 - 20 + 768 * 4 / 5, string, 1, 2.5 * .8, 1024, 768);
- glColor4f(1, 0, 0, 1 - bonustime);
- text->glPrint(1024 / 2 - 10 * string.size(), 768 / 16 - 20 + 768 * 4 / 5, string, 1, 2 * .8, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * string.size(), 768 / 16 - 20 + 768 * 4 / 5, string, 1, 2 * .8, 1024, 768);
+
glColor4f(.5, .5, .5, 1);
}
string3 = " ";
}
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- glColor4f(1, 1, 1, tutorialopac);
- text->glPrint(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 40 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
string = "Press 'tab' to skip to the next item.";
string2 = "Press escape at any time to";
string3 = "pause or exit the tutorial.";
- glColor4f(0, 0, 0, 1);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10, string, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrintOutline(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 * .8 - 4, 0 - 4 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * 1.25 * screenwidth / 1024 * .8, screenwidth, screenheight);
- glColor4f(0.5, 0.5, 0.5, 1);
- text->glPrint(screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10, string, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
- text->glPrint(screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10, string, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string2.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
+ text->glPrintOutlined(0.5, 0.5, 0.5, 1, screenwidth / 2 - 7.6 * string3.size()*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight);
}
//Hot spots
int i = 0;
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(screenwidth / 2 - 7.6 * (i - lastline)*screenwidth / 1024 - 4, screenheight / 16 - 4 + screenheight * 4 / 5 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
- glColor4f(1, 1, 1, tutorialopac);
- text->glPrint(screenwidth / 2 - 7.6 * (i - lastline)*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, screenwidth / 2 - 7.6 * (i - lastline)*screenwidth / 1024, screenheight / 16 + screenheight * 4 / 5 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
lastline = i + 1;
line++;
if (string[i] == '\0')
string = std::string(tempname) + ": ";
if (Dialog::currentScene().color[0] + Dialog::currentScene().color[1] + Dialog::currentScene().color[2] < 1.5) {
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(startx - 2 * 7.6 * string.size()*screenwidth / 1024 - 4, starty - 4, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
- glColor4f(0.7, 0.7, 0.7, tutorialopac);
- text->glPrint(startx - 2 * 7.6 * string.size()*screenwidth / 1024, starty, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
+ text->glPrintOutlined(0.7, 0.7, 0.7, tutorialopac, startx - 2 * 7.6 * string.size()*screenwidth / 1024, starty, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight);
} else {
glColor4f(0, 0, 0, tutorialopac);
text->glPrintOutline(startx - 2 * 7.6 * string.size()*screenwidth / 1024 - 4, starty - 4, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight);
while (!done) {
if (string[i] == '\n' || string[i] > 'z' || string[i] < ' ' || string[i] == '\0') {
if (Dialog::currentScene().color[0] + Dialog::currentScene().color[1] + Dialog::currentScene().color[2] < 1.5) {
- glColor4f(0, 0, 0, tutorialopac);
- text->glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/ - 4, starty - 4 - 20 * screenwidth / 1024 * line, string, 1, 1.5 * 1.25 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
- glColor4f(1, 1, 1, tutorialopac);
- text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
+ text->glPrintOutlined(1, 1, 1, tutorialopac, startx, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
} else {
glColor4f(0, 0, 0, tutorialopac);
- text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
+ text->glPrint(startx, starty - 20 * screenwidth / 1024 * line, string, 1, 1.5 * screenwidth / 1024, screenwidth, screenheight, lastline, i);
}
lastline = i + 1;
line++;
} else {
string = "Score: " + to_string(int(bonustotal));
}
- glColor4f(0, 0, 0, 1);
- text->glPrintOutline(1024 / 40 - 4, 768 / 16 - 4 + 768 * 14 / 16, string, 1, 1.5 * 1.25, 1024, 768);
- glColor4f(1, 0, 0, 1);
- text->glPrint(1024 / 40, 768 / 16 + 768 * 14 / 16, string, 1, 1.5, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1, 1024 / 40, 768 / 16 + 768 * 14 / 16, string, 1, 1.5, 1024, 768);
if (showdamagebar) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
// writing the numbers :
string = "Damages : " + to_string(int(Person::players[0]->damage)) + "/" + to_string(int(Person::players[0]->damagetolerance)) + " (" + to_string(int(Person::players[0]->bloodloss)) + ")";
- glColor4f(0, 0, 0, 1);
- text->glPrintOutline(1024 / 40 - 4, 768 / 16 - 4 + 768 * 14 / 16 - 40, string, 1, 1.5 * 1.25, 1024, 768);
- glColor4f(1, 0, 0, 1);
- text->glPrint(1024 / 40, 768 / 16 + 768 * 14 / 16 - 40, string, 1, 1.5, 1024, 768);
+ text->glPrintOutlined(1, 0, 0, 1, 1024 / 40, 768 / 16 + 768 * 14 / 16 - 40, string, 1, 1.5, 1024, 768);
}
}
} // Loop Until All 256 Are Built
}
-void Text::glPrint(float x, float y, const std::string& string, int set, float size, float width, float height) // Where The Printing Happens
-{
- glPrint(x, y, string, set, size, width, height, 0, string.size());
-}
-
void Text::_glPrint(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end, int offset) // Where The Printing Happens
{
if (set > 1) {
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
}
-void Text::glPrint(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
+void Text::glPrint(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end)
{
+ if (end < 0) {
+ end = string.size();
+ }
_glPrint(x, y, string, set, size, width, height, start, end, 0);
}
-void Text::glPrintOutline(float x, float y, const std::string& string, int set, float size, float width, float height) // Where The Printing Happens
-{
- glPrintOutline(x, y, string, set, size, width, height, 0, string.size());
-}
-
-void Text::glPrintOutline(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
+void Text::glPrintOutline(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end)
{
+ if (end < 0) {
+ end = string.size();
+ }
_glPrint(x, y, string, set, size, width, height, start, end, 256);
}
-void Text::glPrintOutlined(float x, float y, const std::string& string, int set, float size, float width, float height) // Where The Printing Happens
+
+void Text::glPrintOutlined(float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end)
{
- glPrintOutlined(1, 1, 1, x, y, string, set, size, width, height);
+ glPrintOutlined(1, 1, 1, 1, x, y, string, set, size, width, height, start, end);
}
-void Text::glPrintOutlined(float r, float g, float b, float x, float y, const std::string& string, int set, float size, float width, float height) // Where The Printing Happens
+void Text::glPrintOutlined(float r, float g, float b, float a, float x, float y, const std::string& string, int set, float size, float width, float height, int start, int end)
{
- glColor4f(0, 0, 0, 1);
- glPrintOutline( x - 2 * size, y - 2 * size, string, set, size * 2.5 / 2, width, height);
- glColor4f(r, g, b, 1);
- glPrint( x, y, string, set, size, width, height);
+ glColor4f(0, 0, 0, a);
+ glPrintOutline( x - 2 * size, y - 2 * size, string, set, size * 2.5 / 2, width, height, start, end);
+ glColor4f(r, g, b, a);
+ glPrint( x, y, string, set, size, width, height, start, end);
}
Text::Text()
{
base = 0;
}
+
Text::~Text()
{
if (base) {