YAPOG  0.0.1
Yet Another Pokemon Online Game
AnimatedSprite.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_ANIMATEDSPRITE_HPP
2 # define YAPOG_ANIMATEDSPRITE_HPP
3 
4 # include "YAPOG/Macros.hpp"
7 
8 namespace yap
9 {
10  class FrameSwitcher;
11 
15  {
17 
18  public:
19 
20  enum class PlayState
21  {
22  None = 0,
23  Once = 1,
24  Loop = 2
25  };
26 
28 
29  virtual ~AnimatedSprite ();
30 
31  void AddFrame (ISprite* sprite);
32  void RemoveFrame (ISprite* sprite);
33 
34  void ChangeState (PlayState playState);
35 
36  void SetDefaultFrame (IndexType index);
37 
38  protected:
39 
40  AnimatedSprite ();
41  AnimatedSprite (const AnimatedSprite& copy);
42 
43  void SetFrameSwitcher (FrameSwitcher* frameSwitcher);
44 
45  virtual Vector2 HandleGetSize () const;
46 
47  virtual void HandleMove (const Vector2& offset);
48  virtual void HandleScale (const Vector2& factor);
49 
50  virtual void HandleDraw (IDrawingContext& context);
51 
52  virtual void HandleShow (bool isVisible);
53  virtual void HandleChangeColor (const sf::Color& color);
54 
55  virtual void HandleUpdate (const Time& dt);
56 
57  private:
58 
59  void SetCurrentFrame (IndexType index);
60  void SetDefaultFrame ();
61 
64 
71  };
72 } // namespace yap
73 
74 #endif // YAPOG_ANIMATEDSPRITE_HPP