summaryrefslogtreecommitdiff
path: root/src/textparticle.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-05-23 21:22:43 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-05-23 21:22:43 +0000
commit1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41 (patch)
tree93ee24ab1b77f3bc0b57143ab2643ea7e38f951c /src/textparticle.cpp
parentc61786006bf7694f532c77d038fc2cfd8a44b551 (diff)
downloadmana-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.gz
mana-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.bz2
mana-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.xz
mana-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.zip
Made text splash effects fade out.
Diffstat (limited to 'src/textparticle.cpp')
-rw-r--r--src/textparticle.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index e7a0926b..2a2c50e8 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -42,7 +42,22 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
int screenX = (int)mPosX + offsetX;
int screenY = (int)mPosY - int(mPosZ) + offsetY;
+ int alpha = 255;
+
+ if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
+ {
+ alpha *= mLifetimeLeft;
+ alpha /= mFadeOut;
+ };
+
+ if (mLifetimePast < mFadeIn)
+ {
+ alpha *= mLifetimePast;
+ alpha /= mFadeIn;
+ }
+
graphics->setFont(mTextFont);
- graphics->setColor(mTextColor);
+ graphics->setColor(gcn::Color (mTextColor.r, mTextColor.g, mTextColor.b,
+ alpha));
graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER);
}