summaryrefslogtreecommitdiff
path: root/src/imageparticle.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-06-03 16:52:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-06-03 16:52:06 +0000
commit6276c1ff96e449e73e84977110334cd8957c31b6 (patch)
tree66988ea8a28fd9de6c2f31d20a38a4efafee9a99 /src/imageparticle.cpp
parent9b53cd51fdf193c8748909479ec6c356fa7a1731 (diff)
downloadmana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.gz
mana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.bz2
mana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.xz
mana-6276c1ff96e449e73e84977110334cd8957c31b6.zip
Fixed image loading in software mode to not check for alpha layer with images
aren't 32-bit and removed drawImageTransparent from Graphics class, should be set on image.
Diffstat (limited to 'src/imageparticle.cpp')
-rw-r--r--src/imageparticle.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index 86e7e50f..410782bd 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -18,6 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * $Id$
*/
#include "imageparticle.h"
@@ -37,31 +38,26 @@ void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
if (!mAlive)
return;
- int screenX = (int)mPosX + offsetX - mImage->getWidth()/2;
- int screenY = (int)mPosY - int(mPosZ) + offsetY - mImage->getHeight()/2;
+ int screenX = (int) mPosX + offsetX - mImage->getWidth() / 2;
+ int screenY = (int) mPosY - (int) mPosZ + offsetY - mImage->getHeight()/2;
- // check if on screen
- if (screenX + mImage->getWidth() < 0 ||
+ // Check if on screen
+ if (screenX + mImage->getWidth() < 0 ||
screenX > graphics->getWidth() ||
screenY + mImage->getHeight() < 0 ||
screenY > graphics->getHeight())
+ {
return;
+ }
float alphafactor = 1.0f;
if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
- alphafactor *= ((float)mLifetimeLeft / (float)mFadeOut);
+ alphafactor *= (float) mLifetimeLeft / (float) mFadeOut;
if (mLifetimePast < mFadeIn)
- alphafactor *= ((float)mLifetimePast / (float)mFadeIn);
+ alphafactor *= (float) mLifetimePast / (float) mFadeIn;
- if (alphafactor < 1.0f) {
- graphics->drawImageTransparent(mImage,
- screenX,
- screenY,
- alphafactor
- );
- } else {
- graphics->drawImage(mImage, screenX, screenY);
- }
+ mImage->setAlpha(alphafactor);
+ graphics->drawImage(mImage, screenX, screenY);
}