diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-14 19:08:25 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-14 19:23:28 +0200 |
commit | 3591c264f14edf300e7d3ea20577c517a092cf50 (patch) | |
tree | 8748986df0943d162f9011b8f0b2115e137a4054 | |
parent | c316bd0a9ffdbeb85ea80dc3ca2e731062b45c85 (diff) | |
download | mana-3591c264f14edf300e7d3ea20577c517a092cf50.tar.gz mana-3591c264f14edf300e7d3ea20577c517a092cf50.tar.bz2 mana-3591c264f14edf300e7d3ea20577c517a092cf50.tar.xz mana-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.
-rw-r--r-- | src/gui/textrenderer.h | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.h | 3 | ||||
-rw-r--r-- | src/textparticle.cpp | 17 | ||||
-rw-r--r-- | src/textparticle.h | 2 |
5 files changed, 13 insertions, 14 deletions
diff --git a/src/gui/textrenderer.h b/src/gui/textrenderer.h index 712c1312..c8ff5833 100644 --- a/src/gui/textrenderer.h +++ b/src/gui/textrenderer.h @@ -50,7 +50,7 @@ class TextRenderer if (shadow) { graphics->setColor(guiPalette->getColor(Palette::SHADOW, - alpha / 2)); + alpha / 2)); if (outline) { graphics->drawText(text, x + 2, y + 2, align); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index c1423190..7119bfc9 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -946,7 +946,8 @@ void LocalPlayer::initTargetCursor() true, TC_LARGE); } -void LocalPlayer::loadTargetCursor(std::string filename, int width, int height, +void LocalPlayer::loadTargetCursor(const std::string &filename, + int width, int height, bool outRange, TargetCursorSize size) { assert(size > -1); diff --git a/src/localplayer.h b/src/localplayer.h index add5c049..4a85dd75 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -490,7 +490,8 @@ class LocalPlayer : public Player /** * Helper function for loading target cursors */ - void loadTargetCursor(std::string filename, int width, int height, + void loadTargetCursor(const std::string &filename, + int width, int height, bool outRange, Being::TargetCursorSize size); /** Images of the target cursor. */ 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); } diff --git a/src/textparticle.h b/src/textparticle.h index 8b7d3e01..a87137ea 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -47,7 +47,7 @@ class TextParticle : public Particle private: std::string mText; /**< Text of the particle. */ gcn::Font *mTextFont; /**< Font used for drawing the text. */ - const gcn::Color* mColor; /**< Color used for drawing the text. */ + const gcn::Color *mColor; /**< Color used for drawing the text. */ bool mOutline; /**< Make the text better readable */ }; |