#include <map>
#include <vector>
-#include <Moof/Library.hh>
+#include <Moof/Manager.hh>
#include <Moof/Log.hh>
#include <Moof/Script.hh>
class Animation::Impl
{
- friend class Animation;
+public:
/**
* Contains "global" animation data for the various animations which get
* which wants to use these loaded sequences.
*/
- class Data : public Mf::Library<Data>
+ class Data : public Mf::Manager<Data>
{
- friend class Impl;
- friend class Mf::Library<Data>;
+ public:
/**
* A frame of an animation sequence. A frame is merely an index which
class Frame
{
- friend class Impl;
+ public:
unsigned mIndex; ///< Frame index.
Mf::Scalar mDuration; ///< Frame duration.
* that they should be played.
*/
- struct Sequence
+ class Sequence
{
- friend class Impl;
+ public:
std::vector<Frame> mFrames; ///< List of frames.
Mf::Scalar mDelay; ///< Scale frame durations.
* individual sequence.
*/
- void loadFromFile()
+ void init(const std::string& name)
{
Mf::Script script;
- std::string filePath = Animation::getPath(getName());
+ std::string filePath = Animation::getPath(name);
script.importBaseLibrary();
importLogFunctions(script);
std::string nameStr;
name.get(nameStr);
- sequences.insert(std::pair<std::string,Sequence>(nameStr,
+ mSequences.insert(std::pair<std::string,Sequence>(nameStr,
Sequence(script, table)));
return 0;
}
- /**
- * Construction is initialization. The animation class data container
- * registers itself as a mippleton and then loads the animation data.
- */
-
- explicit Data(const std::string& name) :
- Mf::Library<Data>(name)
- {
- loadFromFile();
- }
-
- std::map<std::string,Sequence> sequences; ///< List of sequences.
+ std::map<std::string,Sequence> mSequences; ///< List of sequences.
};
{
std::map<std::string,Data::Sequence>::iterator it;
- it = mData->sequences.find(name);
+ it = mData->mSequences.find(name);
- if (it != mData->sequences.end())
+ if (it != mData->mSequences.end())
{
mCurrentSequence = &(*it).second;
mFrameCounter = 0;