diff options
Diffstat (limited to 'src/imageparticle.cpp')
-rw-r--r-- | src/imageparticle.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp index 8ef2cce9..b7d92277 100644 --- a/src/imageparticle.cpp +++ b/src/imageparticle.cpp @@ -39,23 +39,21 @@ ImageParticle::~ImageParticle() mImage->decRef(); } -void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const +bool ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const { - if (!mAlive || !mImage) - return; + if (!isAlive() || !mImage) + return false; int screenX = (int) mPos.x + offsetX - mImage->getWidth() / 2; int screenY = (int) mPos.y - (int)mPos.z + offsetY - mImage->getHeight()/2; // Check if on screen - if (screenX + mImage->getWidth() < 0 || - screenX > graphics->getWidth() || - screenY + mImage->getHeight() < 0 || - screenY > graphics->getHeight()) - { - return; - } + if (screenX + mImage->getWidth() < 0 + || screenX > graphics->getWidth() + || screenY + mImage->getHeight() < 0 + || screenY > graphics->getHeight()) + return false; mImage->setAlpha(getCurrentAlpha()); - graphics->drawImage(mImage, screenX, screenY); + return graphics->drawImage(mImage, screenX, screenY); } |