summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/sprite/animatedsprite.cpp16
-rw-r--r--src/resources/sprite/animatedsprite.h7
2 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp
index 216d94106..5210ce626 100644
--- a/src/resources/sprite/animatedsprite.cpp
+++ b/src/resources/sprite/animatedsprite.cpp
@@ -330,6 +330,22 @@ void AnimatedSprite::draw(Graphics *restrict const graphics,
posX + mFrame->offsetX, posY + mFrame->offsetY);
}
+void AnimatedSprite::drawRaw(Graphics *restrict const graphics,
+ const int posX,
+ const int posY) const restrict2
+{
+ if (!mFrame || !mFrame->image)
+ return;
+
+ Image *restrict const image = mFrame->image;
+ if (image->getAlpha() != mAlpha)
+ image->setAlpha(mAlpha);
+
+ graphics->drawImage(image,
+ posX,
+ posY);
+}
+
bool AnimatedSprite::setSpriteDirection(const SpriteDirection::Type direction)
restrict2
{
diff --git a/src/resources/sprite/animatedsprite.h b/src/resources/sprite/animatedsprite.h
index 53423b77a..2a40df1e9 100644
--- a/src/resources/sprite/animatedsprite.h
+++ b/src/resources/sprite/animatedsprite.h
@@ -73,6 +73,10 @@ class AnimatedSprite final : public Sprite
const int posX,
const int posY) const restrict2 override final A_NONNULL(2);
+ void drawRaw(Graphics *restrict const graphics,
+ const int posX,
+ const int posY) const restrict2 A_NONNULL(2);
+
int getWidth() const restrict2 override final A_WARN_UNUSED;
int getHeight() const restrict2 override final A_WARN_UNUSED;
@@ -116,6 +120,9 @@ class AnimatedSprite final : public Sprite
void setLastTime(const int time) noexcept
{ mLastTime = time; }
+ const Frame *getFrame() const restrict2
+ { return mFrame; }
+
#ifdef UNITTESTS
SpriteDef *getSprite() restrict2
{ return mSprite; }