diff options
Diffstat (limited to 'src/resources/sprite')
-rw-r--r-- | src/resources/sprite/animatedsprite.cpp | 9 | ||||
-rw-r--r-- | src/resources/sprite/animatedsprite.h | 7 | ||||
-rw-r--r-- | src/resources/sprite/animatedsprite_unittest.cc | 6 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 738f8c31b..60a2d7f9d 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -77,7 +77,8 @@ AnimatedSprite *AnimatedSprite::load(const std::string &restrict filename, AnimatedSprite *restrict const as = new AnimatedSprite(s); #ifdef DEBUG_ANIMATIONS as->setSpriteName(filename); -#endif +#endif // DEBUG_ANIMATIONS + as->play(SpriteAction::STAND); s->decRef(); return as; @@ -100,7 +101,8 @@ AnimatedSprite *AnimatedSprite::delayedLoad(const std::string &restrict AnimatedSprite *restrict const as = new AnimatedSprite(nullptr); #ifdef DEBUG_ANIMATIONS as->setSpriteName(filename); -#endif +#endif // DEBUG_ANIMATIONS + as->play(SpriteAction::STAND); as->setDelayLoad(filename, variant); return as; @@ -114,7 +116,8 @@ AnimatedSprite *AnimatedSprite::clone(const AnimatedSprite *restrict const AnimatedSprite *restrict const sprite = new AnimatedSprite(anim->mSprite); #ifdef DEBUG_ANIMATIONS sprite->setSpriteName(anim->getSpriteName()); -#endif +#endif // DEBUG_ANIMATIONS + sprite->play(SpriteAction::STAND); return sprite; } diff --git a/src/resources/sprite/animatedsprite.h b/src/resources/sprite/animatedsprite.h index 702896be3..7f8332e46 100644 --- a/src/resources/sprite/animatedsprite.h +++ b/src/resources/sprite/animatedsprite.h @@ -135,7 +135,7 @@ class AnimatedSprite final : public Sprite unsigned int getFrameTime() const restrict2 { return mFrameTime; } -#endif +#endif // UNITTESTS #ifdef DEBUG_ANIMATIONS void setSpriteName(const std::string &restrict name) @@ -143,7 +143,7 @@ class AnimatedSprite final : public Sprite std::string getSpriteName() const A_WARN_UNUSED { return mSpriteName; } -#endif +#endif // DEBUG_ANIMATIONS private: bool updateCurrentAnimation(const unsigned int dt) restrict2; @@ -153,7 +153,8 @@ class AnimatedSprite final : public Sprite #ifdef DEBUG_ANIMATIONS std::string mSpriteName; -#endif +#endif // DEBUG_ANIMATIONS + SpriteDirection::Type mDirection; /**< The sprite direction. */ int mLastTime; /**< The last time update was called. */ diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc index 9111434b2..d62c79fc8 100644 --- a/src/resources/sprite/animatedsprite_unittest.cc +++ b/src/resources/sprite/animatedsprite_unittest.cc @@ -67,9 +67,11 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); -#else +#else // USE_SDL2 + graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); -#endif +#endif // USE_SDL2 + ActorSprite::load(); SECTION("basic test 1") |