diff options
author | Majin Sniper <majinsniper@gmx.de> | 2009-02-20 00:19:52 +0100 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-02-19 18:27:45 -0700 |
commit | 1713f33dbd71b6378c8a4e58452fb16147f320d7 (patch) | |
tree | 19edc1a3291b06bf1680394bb1a68986ddca6f0c /src/textparticle.cpp | |
parent | fcc8e48e96f017e4d7551ce7e686dd2e2a1bbcb9 (diff) | |
download | mana-1713f33dbd71b6378c8a4e58452fb16147f320d7.tar.gz mana-1713f33dbd71b6378c8a4e58452fb16147f320d7.tar.bz2 mana-1713f33dbd71b6378c8a4e58452fb16147f320d7.tar.xz mana-1713f33dbd71b6378c8a4e58452fb16147f320d7.zip |
Added a pickup notification as particle effect. Also make a ui option to enable/disable this effect (default is off) and another option to disable the pickup notification in the chat log (default is on).
Diffstat (limited to 'src/textparticle.cpp')
-rw-r--r-- | src/textparticle.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/textparticle.cpp b/src/textparticle.cpp index f38c32ce..3494b97f 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -23,16 +23,18 @@ #include "graphics.h" #include "textparticle.h" +#include <SDL/SDL_ttf.h> TextParticle::TextParticle(Map *map, const std::string &text, int colorR, int colorG, int colorB, - gcn::Font *font): + gcn::Font *font, bool outline): Particle(map), mText(text), mTextFont(font), mColorR(colorR), mColorG(colorG), - mColorB(colorB) + mColorB(colorB), + mOutline(outline) { } @@ -59,6 +61,23 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const } 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); } |