UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
animationset.h
Go to the documentation of this file.
1 #ifndef UGDK_ACTION_ANIMATIONSET_H_
2 #define UGDK_ACTION_ANIMATIONSET_H_
3 
4 #include <string>
5 #include <map>
6 #include <vector>
7 #include <ugdk/action.h>
8 
9 namespace ugdk {
10 
11 namespace action {
12 
13 class AnimationSet {
14 
15  public:
16 
17  AnimationSet();
18  ~AnimationSet();
19 
20  // Deletes all this AnimationSet's content from memory.
21  // Use with caution.
22  void Release();
23 
24  // Returns the animation indexed by index, or NULL if it is not there.
25  Animation* Get(int index);
26 
27  // Adds a modifier sequence to the set, naming it for later requests.
28  void Add(const std::string& name, Animation *sequence);
29  void Add(const std::string& name, ...);
30 
31  // Searches for the animation using the given name.
32  // Returns it if it is found or NULL if else.
33  Animation* Search(const std::string& name);
34 
35  // Optimizes access to the animations identified by the given name.
36  // The caller should be conscious of the returned indexes for later use
37  // of these animations through the Get() method.
38  // Returns the generated index or -1 if the animation was not found.
39  int MakeIndex(const std::string& name);
40 
41  void Print(FILE *out);
42 
43  private:
44 
45  typedef std::map<std::string,Animation*> SequenceMap;
46  typedef std::vector<Animation*> IndexArray;
47 
48  SequenceMap sequences_;
49  IndexArray indexed_sequences_;
50 
51 };
52 
53 } /* namespace action */
54 
55 } /* namespace ugdk */
56 
57 #endif /* UGDK_ACTION_ANIMATIONSET_H_ */