summaryrefslogtreecommitdiff
path: root/src/resources/sprite/animatedsprite.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-05 18:23:50 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-05 18:23:50 +0300
commite210a6f5033944614499a1708be2fa5559479e37 (patch)
tree0d6b6b1ba2e34786b97885947e5ccb7dacbdea1e /src/resources/sprite/animatedsprite.cpp
parent21159adfd8bd3d709793006e1b1e4b2d8ed806d7 (diff)
downloadmanaverse-e210a6f5033944614499a1708be2fa5559479e37.tar.gz
manaverse-e210a6f5033944614499a1708be2fa5559479e37.tar.bz2
manaverse-e210a6f5033944614499a1708be2fa5559479e37.tar.xz
manaverse-e210a6f5033944614499a1708be2fa5559479e37.zip
Add function for draw rescaled animated sprite.
Diffstat (limited to 'src/resources/sprite/animatedsprite.cpp')
-rw-r--r--src/resources/sprite/animatedsprite.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp
index 30eb4dda3..9d7186335 100644
--- a/src/resources/sprite/animatedsprite.cpp
+++ b/src/resources/sprite/animatedsprite.cpp
@@ -338,6 +338,27 @@ void AnimatedSprite::draw(Graphics *restrict const graphics,
posX + mFrame->offsetX, posY + mFrame->offsetY);
}
+void AnimatedSprite::drawRescaled(Graphics *restrict const graphics,
+ const int posX,
+ const int posY,
+ const int dx,
+ const int dy) const restrict2
+{
+ if (mFrame == nullptr ||
+ mFrame->image == nullptr)
+ {
+ return;
+ }
+
+ Image *restrict const image = mFrame->image;
+ image->setAlpha(mAlpha);
+ graphics->drawRescaledImage(image,
+ posX + mFrame->offsetX,
+ posY + mFrame->offsetY,
+ dx,
+ dy);
+}
+
void AnimatedSprite::drawRaw(Graphics *restrict const graphics,
const int posX,
const int posY) const restrict2