diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-26 13:23:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-26 13:23:21 +0300 |
commit | de328959771fcc5f992f13517ea7adacdda61550 (patch) | |
tree | 38c612cd07864006b1a6b84df7ec9e128358f8be /src/text.cpp | |
parent | 16b5831a6640bcd1f6f7f23c7b282544bea2b47d (diff) | |
download | manaplus-de328959771fcc5f992f13517ea7adacdda61550.tar.gz manaplus-de328959771fcc5f992f13517ea7adacdda61550.tar.bz2 manaplus-de328959771fcc5f992f13517ea7adacdda61550.tar.xz manaplus-de328959771fcc5f992f13517ea7adacdda61550.zip |
Improve a bit text class.
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
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) { |