From 993c98c3813b2ad7caf3dcd9761b4c9a17de39b6 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 23 May 2007 21:45:43 +0000 Subject: The color values of text particles are now stored in 3 integers instead of a Guichan color structure. --- src/being.cpp | 2 +- src/particle.cpp | 6 ++++-- src/particle.h | 4 +++- src/textparticle.cpp | 9 +++++---- src/textparticle.h | 8 ++++---- 5 files changed, 17 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 193582e9..5c0bac7f 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -190,7 +190,7 @@ Being::takeDamage(int amount) // show damage number particleEngine->addTextSplashEffect(damage, font, - gcn::Color(255, 255, 255), + 255, 255, 255, mPx + 16, mPy + 16); } diff --git a/src/particle.cpp b/src/particle.cpp index 579bbfc1..b35522ce 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -313,9 +313,11 @@ Particle::addEffect (std::string particleEffectFile, int pixelX, int pixelY) Particle* -Particle::addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color color, int x, int y) +Particle::addTextSplashEffect(std::string text, gcn::Font *font, + int colorR, int colorG, int colorB, int x, int y) { - Particle *newParticle = new TextParticle(mMap, text, font, color); + Particle *newParticle = new TextParticle(mMap, text, font, + colorR, colorG, colorB); newParticle->setPosition( x, y, 0 diff --git a/src/particle.h b/src/particle.h index f208225a..ed360ea2 100644 --- a/src/particle.h +++ b/src/particle.h @@ -112,7 +112,9 @@ class Particle : public Sprite * Creates a standalone text particle */ Particle* - addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color color, int x, int y); + addTextSplashEffect(std::string text, gcn::Font *font, + int colorR, int colorG, int colorB, + int x, int y); /** * Adds an emitter to the particle diff --git a/src/textparticle.cpp b/src/textparticle.cpp index 2a2c50e8..ef4ebc48 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -26,11 +26,13 @@ #include "graphics.h" TextParticle::TextParticle(Map *map, const std::string &text, gcn::Font *font, - gcn::Color color): + int colorR, int colorG, int colorB): Particle(map), mText(text), mTextFont(font), - mTextColor(color) + mColorR(colorR), + mColorG(colorG), + mColorB(colorB) { } @@ -57,7 +59,6 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const } graphics->setFont(mTextFont); - graphics->setColor(gcn::Color (mTextColor.r, mTextColor.g, mTextColor.b, - alpha)); + graphics->setColor(gcn::Color (mColorR, mColorG, mColorB, alpha)); graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER); } diff --git a/src/textparticle.h b/src/textparticle.h index 3f3ca0ec..75e1f8b1 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -34,7 +34,7 @@ class TextParticle : public Particle { public: TextParticle(Map *map, const std::string &text, gcn::Font *font, - gcn::Color color); + int colorR, int colorG, int colorB); /** * Draws the particle image */ @@ -45,9 +45,9 @@ class TextParticle : public Particle virtual int getPixelY() const { return (int)(mPosY + mPosZ); } private: - std::string mText; /** Text of the particle */ - gcn::Font *mTextFont; /** Font used for drawing the text */ - gcn::Color mTextColor; /** Color used for drawing the text */ + std::string mText; /**< Text of the particle */ + gcn::Font *mTextFont; /**< Font used for drawing the text */ + int mColorR, mColorG, mColorB; /**< Color used for drawing the text */ }; #endif -- cgit v1.2.3-70-g09d2