UGDK
src/ugdk/action/animationset.h
Go to the documentation of this file.
00001 #ifndef UGDK_ACTION_ANIMATIONSET_H_
00002 #define UGDK_ACTION_ANIMATIONSET_H_
00003 
00004 #include <string>
00005 #include <map>
00006 #include <vector>
00007 #include <ugdk/action.h>
00008 
00009 namespace ugdk {
00010 
00011 namespace action {
00012 
00013 class AnimationSet {
00014 
00015   public:
00016 
00017     AnimationSet();
00018     ~AnimationSet();
00019 
00020     // Deletes all this AnimationSet's content from memory.
00021     // Use with caution.
00022     void Release();
00023 
00024     // Returns the animation indexed by index, or NULL if it is not there.
00025     Animation* Get(int index);
00026 
00027     // Adds a modifier sequence to the set, naming it for later requests.
00028     void Add(const std::string& name, Animation *sequence);
00029     void Add(const std::string& name, ...);
00030 
00031     // Searches for the animation using the given name.
00032     // Returns it if it is found or NULL if else.
00033     Animation* Search(const std::string& name);
00034 
00035     // Optimizes access to the animations identified by the given name.
00036     // The caller should be conscious of the returned indexes for later use
00037     // of these animations through the Get() method.
00038     // Returns the generated index or -1 if the animation was not found.
00039     int MakeIndex(const std::string& name);
00040 
00041     void Print(FILE *out);
00042 
00043   private:
00044 
00045     typedef std::map<std::string,Animation*> SequenceMap;
00046     typedef std::vector<Animation*> IndexArray;
00047 
00048     SequenceMap sequences_;
00049     IndexArray indexed_sequences_;
00050 
00051 };
00052 
00053 } /* namespace action */
00054 
00055 } /* namespace ugdk */
00056 
00057 #endif /* UGDK_ACTION_ANIMATIONSET_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines