From b875124824794a7762414db76ed9f953b8ba320f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 26 Dec 2008 12:21:48 +0000 Subject: default player settings in player.ini, palette text colors, cleanups --- src/render/text.cc | 14 +++++++++----- src/render/text.h | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/render') diff --git a/src/render/text.cc b/src/render/text.cc index 127605b..f4b75c4 100644 --- a/src/render/text.cc +++ b/src/render/text.cc @@ -62,6 +62,15 @@ 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); + } else if (('0' <= c) && (c <= '9')) { + base_color[(size_t) (c - '0')]->assign(color); + } +} + void Text::setcolor(const char color) { if (('A' <= color) && (color <= 'Z')) { @@ -71,11 +80,6 @@ void Text::setcolor(const char color) else if (('0' <= color) && (color <= '9')) { gl::color(*base_color[(size_t) (color - '0')]); } - - else { - gl::color(1, 1, 1); - } - } void Text::setfont(const char *texture, float width, float height) diff --git a/src/render/text.h b/src/render/text.h index 5cf18ea..4762639 100644 --- a/src/render/text.h +++ b/src/render/text.h @@ -23,6 +23,9 @@ public: static void shutdown(); + /// assign system colors + static void assign_color(const char c, const math::Color &color); + /// draw a text string static void draw(float x, float y, const std::string & text); -- cgit v1.2.3