AnimatedSprite.hpp 547 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. using namespace sf;
  4. struct Animation;
  5. class AnimatedSprite: public Sprite {
  6. public:
  7. AnimatedSprite();
  8. virtual ~AnimatedSprite();
  9. void addAnimation(std::string armored, std::string filename, unsigned duration, std::string name, bool loop);
  10. void setAnimation(std::string name, bool armored);
  11. virtual void animate();
  12. bool isJumping() const
  13. {
  14. return _jumping;
  15. }
  16. bool armored;
  17. protected:
  18. Animation* _current;
  19. bool _jumping;
  20. Clock _anclock;
  21. private:
  22. std::map<std::string, Animation> _anim;
  23. };