From c7fa79ff1704d86e12e12b83e1e4745ca27a543a Mon Sep 17 00:00:00 2001 From: sniper Date: Wed, 11 Mar 2009 17:19:31 +0100 Subject: Added a class for rendering of floating text This is a header only-class that merges the textrendering of the TextParticle and Text classes. It is done to reduce code duplication and to prepare some color configuration gui. --- src/text.cpp | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) (limited to 'src/text.cpp') diff --git a/src/text.cpp b/src/text.cpp index cb4587d3..5a912d17 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -30,6 +30,8 @@ #include "resources/image.h" #include "gui/gui.h" +#include "gui/palette.h" +#include "gui/textrenderer.h" int Text::mInstances = 0; ImageRect Text::mBubble; @@ -129,37 +131,9 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) */ } - // Text shadow - graphics->setColor(gcn::Color(0, 0, 0)); - graphics->drawText(mText, mX - xOff + 1, mY - yOff + 1, - gcn::Graphics::LEFT); - - if (!mIsSpeech) { - graphics->setColor(gcn::Color(0, 0, 0, 64)); - /* - // TODO: Reanable when we can draw it nicely in software mode - graphics->drawText(mText, mX - xOff + 2, mY - yOff + 2, - gcn::Graphics::LEFT); - graphics->drawText(mText, mX - xOff + 1, mY - yOff + 2, - gcn::Graphics::LEFT); - graphics->drawText(mText, mX - xOff + 2, mY - yOff + 1, - gcn::Graphics::LEFT); - */ - - // Text outline - graphics->setColor(gcn::Color(0, 0, 0)); - graphics->drawText(mText, mX - xOff + 1, mY - yOff, - gcn::Graphics::LEFT); - graphics->drawText(mText, mX - xOff - 1, mY - yOff, - gcn::Graphics::LEFT); - graphics->drawText(mText, mX - xOff, mY - yOff + 1, - gcn::Graphics::LEFT); - graphics->drawText(mText, mX - xOff, mY - yOff - 1, - gcn::Graphics::LEFT); - } - - graphics->setColor(mColor); - graphics->drawText(mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT); + TextRenderer::renderText(graphics, mText, + mX - xOff, mY - yOff, gcn::Graphics::LEFT, + &mColor, boldFont, !mIsSpeech, true); } FlashText::FlashText(const std::string &text, int x, int y, -- cgit v1.2.3-70-g09d2