summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/sprite/animatedsprite.cpp21
-rw-r--r--src/resources/sprite/animatedsprite.h6
2 files changed, 27 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
diff --git a/src/resources/sprite/animatedsprite.h b/src/resources/sprite/animatedsprite.h
index 259b6fe84..01a142f31 100644
--- a/src/resources/sprite/animatedsprite.h
+++ b/src/resources/sprite/animatedsprite.h
@@ -74,6 +74,12 @@ class AnimatedSprite final : public Sprite
const int posX,
const int posY) const restrict2 override final A_NONNULL(2);
+ void drawRescaled(Graphics *restrict const graphics,
+ const int posX,
+ const int posY,
+ const int dx,
+ const int dy) const restrict2 A_NONNULL(2);
+
void drawRaw(Graphics *restrict const graphics,
const int posX,
const int posY) const restrict2 A_NONNULL(2);