From de328959771fcc5f992f13517ea7adacdda61550 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 May 2015 13:23:21 +0300 Subject: Improve a bit text class. --- src/text.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/text.cpp b/src/text.cpp index fac2dba04..4f56f7cdf 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -53,7 +53,7 @@ Text::Text(const std::string &text, const int x, const int y, mXOffset(0), mText(text), mColor(color), - mOutlineColor(theme->getColor(Theme::OUTLINE, 255)), + mOutlineColor(isSpeech ? color : theme->getColor(Theme::OUTLINE, 255)), mIsSpeech(isSpeech) { if (!textManager) @@ -117,7 +117,15 @@ Text::~Text() void Text::setColor(const Color *const color) { - mColor = color; + if (mIsSpeech) + { + mColor = color; + mOutlineColor = color; + } + else + { + mColor = color; + } } void Text::adviseXY(const int x, const int y, const bool move) @@ -145,24 +153,17 @@ void Text::draw(Graphics *const graphics, const int xOff, const int yOff) mBubble); } - if (!mIsSpeech) - { - mFont->drawString(graphics, - *mColor, mOutlineColor, - mText, mX - xOff, mY - yOff); - } - else - { - mFont->drawString(graphics, - *mColor, *mColor, - mText, mX - xOff, mY - yOff); - } + mFont->drawString(graphics, + *mColor, mOutlineColor, + mText, mX - xOff, mY - yOff); BLOCK_END("Text::draw") } -FlashText::FlashText(const std::string &text, const int x, const int y, +FlashText::FlashText(const std::string &text, + const int x, const int y, const Graphics::Alignment alignment, - const Color *const color, Font *const font) : + const Color *const color, + Font *const font) : Text(text, x, y, alignment, color, false, font), mTime(0) { -- cgit v1.2.3-60-g2f50