diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-07 17:13:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-07 17:13:01 +0300 |
commit | 852617a2ea3cfe83c1d0aec134d9369aa5c3af7b (patch) | |
tree | a5a2620aa927c6a4868d2061b24f3f9d446cdc0a /src | |
parent | eea33c9a746a7e44f7f61d13d679c9c9535a7244 (diff) | |
download | mv-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.gz mv-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.bz2 mv-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.tar.xz mv-852617a2ea3cfe83c1d0aec134d9369aa5c3af7b.zip |
Improve a bit imageparticle draw.
Diffstat (limited to 'src')
-rw-r--r-- | src/particle/imageparticle.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp index d6914eafc..5a67886c0 100644 --- a/src/particle/imageparticle.cpp +++ b/src/particle/imageparticle.cpp @@ -75,15 +75,17 @@ void ImageParticle::draw(Graphics *restrict const graphics, if (mAlive != AliveStatus::ALIVE || !mImage) return; + const int w = mImage->mBounds.w; + const int h = mImage->mBounds.h; const int screenX = CAST_S32(mPos.x) - + offsetX - mImage->mBounds.w / 2; + + offsetX - w / 2; const int screenY = CAST_S32(mPos.y) - CAST_S32(mPos.z) - + offsetY - mImage->mBounds.h / 2; + + offsetY - h / 2; // Check if on screen - if (screenX + mImage->mBounds.w < 0 || + if (screenX + w < 0 || screenX > graphics->mWidth || - screenY + mImage->mBounds.h < 0 || + screenY + h < 0 || screenY > graphics->mHeight) { return; |