summaryrefslogtreecommitdiff
path: root/src/textparticle.cpp
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-02-20 00:19:52 +0100
committerIra Rice <irarice@gmail.com>2009-02-20 08:35:25 -0700
commitb2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9 (patch)
treeb7583428f7462c5a6711dfa7d92b43076ea8f29b /src/textparticle.cpp
parent00bbc2186302fe4365f08903a209e03bb8feb4c5 (diff)
downloadmana-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.gz
mana-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.bz2
mana-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.xz
mana-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.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.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 3283f9fd..8a8948f4 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -24,16 +24,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)
{
}
@@ -60,6 +62,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);
}