X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGraphic%2FText.cpp;h=2cf73aa60208d169ccc1a8710f652bc38ecb7943;hb=8d1e44bf4f8448b2d9f0add10a1207c3f81ac5c7;hp=ffc8b0a22db3154cc2427de4ab075ca39cacf020;hpb=24c49b5bd8c82cd433fffe3456334bd3be743da9;p=lugaru.git diff --git a/Source/Graphic/Text.cpp b/Source/Graphic/Text.cpp index ffc8b0a..2cf73aa 100644 --- a/Source/Graphic/Text.cpp +++ b/Source/Graphic/Text.cpp @@ -77,11 +77,6 @@ void Text::BuildFont() // Build Our Font Display List } // 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) { @@ -112,37 +107,40 @@ void Text::_glPrint(float x, float y, const std::string& string, int set, float 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) {