00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_ANIMATEDSPRITE_HPP
00026 #define SFML_ANIMATEDSPRITE_HPP
00027
00029
00031 #include <SFML/Graphics/Sprite.hpp>
00032 #include <SFML/System/Clock.hpp>
00033 #include <vector>
00034
00035
00040 class SFML_API sfAnimatedSprite : public sfSprite
00041 {
00042 public :
00043
00048 sfAnimatedSprite();
00049
00059 sfAnimatedSprite(const sfImage& Image, const sfIntRect& SourceRect, unsigned int FrameWidth, unsigned int FrameHeight);
00060
00070 void CreateAnimation(const sfImage& Image, const sfIntRect& SourceRect, unsigned int FrameWidth, unsigned int FrameHeight);
00071
00079 void AddFrame(const sfIntRect& FrameRect, int Index = -1);
00080
00087 void SetTiming(float Timing);
00088
00095 float GetTiming() const;
00096
00097 protected :
00098
00103 virtual void Render(sfRenderWindow& Window);
00104
00105 private :
00106
00108
00110 float myTiming;
00111 std::vector<sfIntRect> myFrames;
00112 unsigned int myCurrentFrame;
00113 sfClock myTimer;
00114 };
00115
00116
00117 #endif // SFML_ANIMATEDSPRITE_HPP