summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/textrenderer.h2
-rw-r--r--src/localplayer.cpp3
-rw-r--r--src/localplayer.h3
-rw-r--r--src/textparticle.cpp17
-rw-r--r--src/textparticle.h2
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 */
};