summaryrefslogtreecommitdiff
path: root/src/textparticle.cpp
diff options
context:
space:
mode:
authorBlue <bluesansdouze@gmail.com>2009-05-18 01:19:32 +0200
committerBlue <bluesansdouze@gmail.com>2009-05-18 01:19:32 +0200
commit7b76f0e8c4c489254d7519e2916b951601423801 (patch)
treee4430176f02eeec32ebb56b42933b6416e7895df /src/textparticle.cpp
parent22685431a23b05d66af28abda488d0891b1c0a34 (diff)
parentaaec4d115cd0048bbc4bed3d8b1d33492b2a51fa (diff)
downloadmana-client-7b76f0e8c4c489254d7519e2916b951601423801.tar.gz
mana-client-7b76f0e8c4c489254d7519e2916b951601423801.tar.bz2
mana-client-7b76f0e8c4c489254d7519e2916b951601423801.tar.xz
mana-client-7b76f0e8c4c489254d7519e2916b951601423801.zip
Merge branch 'master' of git@gitorious.org:tmw/mainline
Diffstat (limited to 'src/textparticle.cpp')
-rw-r--r--src/textparticle.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 04b7abe1..da176087 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -26,7 +26,7 @@
#include "gui/textrenderer.h"
TextParticle::TextParticle(Map *map, const std::string &text,
- const gcn::Color* color,
+ const gcn::Color *color,
gcn::Font *font, bool outline):
Particle(map),
mText(text),
@@ -47,18 +47,15 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
float alpha = mAlpha * 255.0f;
if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
- {
- alpha *= mLifetimeLeft;
- alpha /= mFadeOut;
- }
+ alpha = alpha * mLifetimeLeft / mFadeOut;
if (mLifetimePast < mFadeIn)
- {
- alpha *= mLifetimePast;
- alpha /= mFadeIn;
- }
+ alpha = alpha * mLifetimePast / mFadeIn;
+
+ gcn::Color color = *mColor;
+ color.a = (int) alpha;
TextRenderer::renderText(graphics, mText,
screenX, screenY, gcn::Graphics::CENTER,
- *mColor, mTextFont, mOutline, false, (int) alpha);
+ color, mTextFont, mOutline, false, (int) alpha);
}