summaryrefslogtreecommitdiff
path: root/src/resources/sprite
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-05 22:31:49 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-05 22:31:49 +0300
commit73432d5972f8a3d2a339260246f3a44842dac58e (patch)
tree9352472b7fb0714b2d898a19f343f8b0456afa38 /src/resources/sprite
parent12273c046fff6b2f778ef4c3cc0d8014d86233e5 (diff)
downloadmanaplus-73432d5972f8a3d2a339260246f3a44842dac58e.tar.gz
manaplus-73432d5972f8a3d2a339260246f3a44842dac58e.tar.bz2
manaplus-73432d5972f8a3d2a339260246f3a44842dac58e.tar.xz
manaplus-73432d5972f8a3d2a339260246f3a44842dac58e.zip
Add support for play animation in cutins.
Diffstat (limited to 'src/resources/sprite')
-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; }