Game Develop C++ Platform: Direction.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Direction.h
Go to the documentation of this file.
1
6 #ifndef DIRECTION_H
7 #define DIRECTION_H
8 #include <string>
9 #include <vector>
10 #include <SFML/Graphics.hpp>
11 #include "GDCpp/Sprite.h"
12 class TiXmlElement;
13
14 using namespace std;
15
24 class GD_API Direction
25 {
26 public:
27 Direction();
28 virtual ~Direction() {};
29
33 inline bool IsLooping() const { return loop; }
34
38 void SetLoop(bool loop_);
39
43 inline float GetTimeBetweenFrames() const { return timeBetweenFrame; }
44
49 void SetTimeBetweenFrames(float time);
50
56 const Sprite & GetSprite(unsigned int nb) const;
57
63 Sprite & GetSprite(unsigned int nb);
64
69 inline bool HasNoSprites() const { return sprites.empty(); }
70
75 inline unsigned int GetSpriteCount() const { return sprites.size(); }
76
81 void RemoveSprite(unsigned int index);
82
86 inline void RemoveAllSprites() { sprites.clear(); }
87
91 void AddSprite( const Sprite & sprite );
92
96 void SwapSprites(unsigned int firstSpriteIndex, unsigned int secondSpriteIndex);
97
98 void LoadFromXml(const TiXmlElement * element);
99 #if defined(GD_IDE_ONLY)
100 void SaveToXml(TiXmlElement * element) const;
101 #endif
102
103 private:
104 bool loop;
105 float timeBetweenFrame;
106 vector < Sprite > sprites;
107
108 static Sprite badSprite;
109 };
110
111 #endif // DIRECTION_H
112