X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FAnimation.cc;h=477997037230b125635f28cf4980d8ffa3d3cc3a;hp=593f44e1aff3df4a492ed2c277bfa91cd46704ff;hb=e973a129b5b83b628ba3f09e8c95682fc74080cd;hpb=7f3984f3f9524f5b6813e01ceb2fe576dadff94e diff --git a/src/Animation.cc b/src/Animation.cc index 593f44e..4779970 100644 --- a/src/Animation.cc +++ b/src/Animation.cc @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -47,7 +47,7 @@ class Animation::Impl { - friend class Animation; +public: /** * Contains "global" animation data for the various animations which get @@ -55,10 +55,9 @@ class Animation::Impl * which wants to use these loaded sequences. */ - class Data : public Mf::Library + class Data : public Mf::Manager { - friend class Impl; - friend class Mf::Library; + public: /** * A frame of an animation sequence. A frame is merely an index which @@ -68,7 +67,7 @@ class Animation::Impl class Frame { - friend class Impl; + public: unsigned mIndex; ///< Frame index. Mf::Scalar mDuration; ///< Frame duration. @@ -98,9 +97,9 @@ class Animation::Impl * that they should be played. */ - struct Sequence + class Sequence { - friend class Impl; + public: std::vector mFrames; ///< List of frames. Mf::Scalar mDelay; ///< Scale frame durations. @@ -161,13 +160,13 @@ class Animation::Impl * 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(); - importLogPrintFunction(script); + importLogFunctions(script); importAnimationBindings(script); if (script.doFile(filePath) != Mf::Script::SUCCESS) @@ -186,7 +185,7 @@ class Animation::Impl std::string nameStr; name.get(nameStr); - sequences.insert(std::pair(nameStr, + mSequences.insert(std::pair(nameStr, Sequence(script, table))); return 0; @@ -208,18 +207,7 @@ class Animation::Impl } - /** - * 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(name) - { - loadFromFile(); - } - - std::map sequences; ///< List of sequences. + std::map mSequences; ///< List of sequences. }; @@ -246,9 +234,9 @@ class Animation::Impl { std::map::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;