diff options
author | sniper <sniper@livecd.janhome.net> | 2009-03-11 17:19:31 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-12 21:03:20 -0600 |
commit | 393c1085ed1cb24092778594d2945a39428e41ad (patch) | |
tree | de676791f4cfdd7ef8a0cd8bcc2c1dae64dda885 /src/textparticle.cpp | |
parent | 3ea4f74915184c08398bdf15e62d9667321ab15c (diff) | |
download | mana-393c1085ed1cb24092778594d2945a39428e41ad.tar.gz mana-393c1085ed1cb24092778594d2945a39428e41ad.tar.bz2 mana-393c1085ed1cb24092778594d2945a39428e41ad.tar.xz mana-393c1085ed1cb24092778594d2945a39428e41ad.zip |
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.
Diffstat (limited to 'src/textparticle.cpp')
-rw-r--r-- | src/textparticle.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/textparticle.cpp b/src/textparticle.cpp index 8a8948f4..a065eadd 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -22,10 +22,12 @@ #include <guichan/color.hpp> -#include "graphics.h" -#include "textparticle.h" #include <SDL/SDL_ttf.h> +#include "textparticle.h" + +#include "gui/textrenderer.h" + TextParticle::TextParticle(Map *map, const std::string &text, int colorR, int colorG, int colorB, gcn::Font *font, bool outline): @@ -61,24 +63,8 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const alpha /= mFadeIn; } - graphics->setFont(mTextFont); - if (mOutline) - { - graphics->setColor(gcn::Color(0, 0, 0, (int)(alpha/4))); - // Text outline - graphics->setColor(gcn::Color(0, 0, 0, (int)alpha)); - graphics->drawText(mText, screenX + 1, screenY, - gcn::Graphics::CENTER); - - graphics->drawText(mText, screenX - 1, screenY, - gcn::Graphics::CENTER); - - graphics->drawText(mText, screenX, screenY + 1, - gcn::Graphics::CENTER); - - graphics->drawText(mText, screenX, screenY - 1, - gcn::Graphics::CENTER); - } - graphics->setColor(gcn::Color(mColorR, mColorG, mColorB, (int)alpha)); - graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER); + TextRenderer::renderText(graphics, mText, + screenX, screenY, gcn::Graphics::CENTER, + &gcn::Color(mColorR, mColorG, mColorB), mTextFont, mOutline, false, + (int) alpha); } |