diff options
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/text.cpp b/src/text.cpp index f6c71dba..216b02e2 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -28,10 +28,10 @@ #include "gui/gui.h" #include "gui/palette.h" -#include "gui/theme.h" #include "resources/resourcemanager.h" #include "resources/image.h" +#include "resources/theme.h" #include <guichan/font.hpp> @@ -41,17 +41,22 @@ Image *Text::mBubbleArrow; Text::Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color* color, bool isSpeech) : + const gcn::Color* color, bool isSpeech, + gcn::Font *font) : mText(text), mColor(color), - mFont(gui->getFont()), mIsSpeech(isSpeech) { + if (!font) + mFont = gui->getFont(); + else + mFont = font; + if (textManager == 0) { textManager = new TextManager; Image *sbImage = Theme::getImageFromTheme("bubble.png|W:#" - + config.getValue("speechBubblecolor", "000000")); + + config.getStringValue("speechBubblecolor")); mBubble.grid[0] = sbImage->getSubImage(0, 0, 5, 5); mBubble.grid[1] = sbImage->getSubImage(5, 0, 5, 5); mBubble.grid[2] = sbImage->getSubImage(10, 0, 5, 5); @@ -62,7 +67,7 @@ Text::Text(const std::string &text, int x, int y, mBubble.grid[7] = sbImage->getSubImage(5, 10, 5, 5); mBubble.grid[8] = sbImage->getSubImage(10, 10, 5, 5); mBubbleArrow = sbImage->getSubImage(0, 15, 15, 10); - const float bubbleAlpha = config.getValue("speechBubbleAlpha", 1.0); + const float bubbleAlpha = config.getFloatValue("speechBubbleAlpha"); for (int i = 0; i < 9; i++) { mBubble.grid[i]->setAlpha(bubbleAlpha); @@ -145,8 +150,8 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) FlashText::FlashText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color *color) : - Text(text, x, y, alignment, color), + const gcn::Color *color, gcn::Font *font) : + Text(text, x, y, alignment, color, false, font), mTime(0) { } |