diff options
Diffstat (limited to 'src/render/text.cc')
-rw-r--r-- | src/render/text.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/render/text.cc b/src/render/text.cc index f4b75c4..cd169b5 100644 --- a/src/render/text.cc +++ b/src/render/text.cc @@ -31,11 +31,11 @@ void Text::init() base_color[6] = new math::Color(1, 0, 1); base_color[7] = new math::Color(1, 1, 1); - for (size_t i=0; i< 26; i++) { + for (size_t i = 0; i < 26; i++) { core_color[i] = new math::Color(.75, .75, .75); } - // N - normal color + // N - normal color core_color[(size_t)('N'-'A')]->assign(.75, .75, .75); // D - Debug color core_color[(size_t)('D'-'A')]->assign(.5, .5, .5); @@ -51,12 +51,12 @@ void Text::init() void Text::shutdown() { - for (size_t i=0; i< 7; i++) { + for (size_t i = 0; i < 7; i++) { delete base_color[i]; base_color[i] = 0; } - for (size_t i=0; i< 26; i++) { + for (size_t i = 0; i < 26; i++) { delete core_color[i]; core_color[i] = 0; } @@ -65,20 +65,20 @@ void Text::shutdown() void Text::assign_color(const char c, const math::Color &color) { if (('A' <= c) && (c <= 'Z')) { - core_color[(size_t) (c - 'A')]->assign(color); + core_color[(size_t)(c - 'A')]->assign(color); } else if (('0' <= c) && (c <= '9')) { - base_color[(size_t) (c - '0')]->assign(color); + base_color[(size_t)(c - '0')]->assign(color); } } void Text::setcolor(const char color) { if (('A' <= color) && (color <= 'Z')) { - gl::color(*core_color[(size_t) (color - 'A')]); - } + gl::color(*core_color[(size_t)(color - 'A')]); + } else if (('0' <= color) && (color <= '9')) { - gl::color(*base_color[(size_t) (color - '0')]); + gl::color(*base_color[(size_t)(color - '0')]); } } @@ -105,16 +105,16 @@ void Text::draw(float x, float y, const char ascii) gl::begin(gl::Quads); glTexCoord2f(fcol, frow); - gl::vertex(x,y, 0); + gl::vertex(x, y, 0); glTexCoord2f(fcol + 0.0625f, frow); - gl::vertex(x+text_fontwidth,y, 0); + gl::vertex(x + text_fontwidth, y, 0); - glTexCoord2f(fcol +0.0625f, frow + 0.0625f); - gl::vertex(x+text_fontwidth,y+text_fontheight, 0); + glTexCoord2f(fcol + 0.0625f, frow + 0.0625f); + gl::vertex(x + text_fontwidth, y + text_fontheight, 0); - glTexCoord2f(fcol, frow+0.0625f); - gl::vertex(x,y+text_fontheight, 0); + glTexCoord2f(fcol, frow + 0.0625f); + gl::vertex(x, y + text_fontheight, 0); gl::end(); } @@ -127,10 +127,10 @@ void Text::draw(float x, float y, const char *text) while (*c) { if (aux::is_base_color_code(c)) { c++; - gl::color(*base_color[ (size_t)(*c - '0')]); + gl::color(*base_color[(size_t)(*c - '0')]); } else if (aux::is_core_color_code(c)) { c++; - gl::color(*core_color[ (size_t)(*c - 'A')]); + gl::color(*core_color[(size_t)(*c - 'A')]); } else { draw(x, y, *c); x += text_fontwidth; @@ -142,7 +142,7 @@ void Text::draw(float x, float y, const char *text) void Text::draw(float x, float y, std::stringstream & textstream) { char line[MAXCMDSIZE]; - while (textstream.getline(line, MAXCMDSIZE-1)) { + while (textstream.getline(line, MAXCMDSIZE - 1)) { draw(x, y, line); y += text_fontheight; } |