1 //////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2004-2011 by The Allacrost Project 3 // Copyright (C) 2012-2016 by Bertram (Valyria Tear) 4 // All Rights Reserved 5 // 6 // This code is licensed under the GNU GPL version 2. It is free software and 7 // you may modify it and/or redistribute it under the terms of this license. 8 // See https://www.gnu.org/copyleft/gpl.html for details. 9 //////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef __BATTLE_ANIMATION_HEADER__ 12 #define __BATTLE_ANIMATION_HEADER__ 13 14 #include "battle_object.h" 15 16 #include "engine/video/image.h" 17 18 namespace vt_battle 19 { 20 21 namespace private_battle 22 { 23 24 //! \brief A class representing animated images used as battle objects: 25 //! used also for spell effects, attack effects, ... 26 class BattleAnimation : public BattleObject 27 { 28 public: 29 BattleAnimation(const std::string& animation_filename); 30 31 //! Used to be drawn at the right time by the battle mode. 32 void DrawSprite(); 33 34 Update()35 void Update() { 36 _animation.Update(); 37 } 38 39 //! Permits to restart the animation. Reset()40 void Reset() { 41 _animation.ResetAnimation(); 42 } 43 SetVisible(bool show)44 void SetVisible(bool show) { 45 _visible = show; 46 } 47 IsVisible()48 bool IsVisible() const { 49 return _visible; 50 } 51 52 //! Tells whether the effect can be scheduled for removal from memory. CanBeRemoved()53 bool CanBeRemoved() const { 54 return _can_be_removed; 55 } 56 Remove()57 void Remove() { 58 _can_be_removed = true; 59 } 60 61 //! Get the animatedImage for deeper manipulations. GetAnimatedImage()62 vt_video::AnimatedImage& GetAnimatedImage() { 63 return _animation; 64 } 65 66 protected: 67 //! The particle effect class used internally 68 vt_video::AnimatedImage _animation; 69 70 //! Set whether the animation is drawn. 71 bool _visible; 72 73 //! Set whether the animation can be removed from memory (now useless). 74 bool _can_be_removed; 75 }; 76 77 } // namespace private_battle 78 79 } // namespace vt_battle 80 81 #endif // __BATTLE_ANIMATION_HEADER__ 82