summaryrefslogtreecommitdiff
path: root/src/textparticle.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-14 19:08:25 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-14 19:23:28 +0200
commit3591c264f14edf300e7d3ea20577c517a092cf50 (patch)
tree8748986df0943d162f9011b8f0b2115e137a4054 /src/textparticle.cpp
parentc316bd0a9ffdbeb85ea80dc3ca2e731062b45c85 (diff)
downloadmana-client-3591c264f14edf300e7d3ea20577c517a092cf50.tar.gz
mana-client-3591c264f14edf300e7d3ea20577c517a092cf50.tar.bz2
mana-client-3591c264f14edf300e7d3ea20577c517a092cf50.tar.xz
mana-client-3591c264f14edf300e7d3ea20577c517a092cf50.zip
Fixed alpha to also apply to the main text of a text particle
It was only being applied to the outline and shadow. This improves the fadeout a little, but because the text is being rendered multiple times, it still looks strange.
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);
}