diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/text.cc | 14 | ||||
-rw-r--r-- | src/render/text.h | 3 |
2 files changed, 12 insertions, 5 deletions
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); |