X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FAnimation.cc;h=39dcb5a40a8b643a7e98958e293ecdcfc7b30ac4;hp=3c418f7052027b17f32bb3305e821563be151667;hb=5fa5f117f28922a7e539a432367960c1a61f837d;hpb=c2321281bf12a7efaedde930422c7ddbc92080d4 diff --git a/src/Moof/Animation.cc b/src/Moof/Animation.cc index 3c418f7..39dcb5a 100644 --- a/src/Moof/Animation.cc +++ b/src/Moof/Animation.cc @@ -39,14 +39,14 @@ namespace Mf { /** * The collection of nested animation classes. The animation implementation - * consists of an AnimationImpl classes which is allocated and initialized with - * the interface object. This class contains the specific fields which are - * required to run a single instance of an animation. The sequence data is - * loaded in a difference class which can be shared amongst multiple animation - * implementation instances. + * consists of an Impl class which is allocated and initialized with the + * interface object. This class contains the specific fields which are required + * to run a single instance of an animation. The sequence data is loaded in a + * different class which can be shared amongst multiple animation implementation + * instances. */ -struct Animation::AnimationImpl +struct Animation::Impl { /** @@ -55,7 +55,7 @@ struct Animation::AnimationImpl * which wants to use these loaded sequences. */ - struct AnimationData : public Mippleton + struct GlobalData : public Mippleton { /** * A frame of an animation sequence. A frame is merely an index which @@ -83,7 +83,7 @@ struct Animation::AnimationImpl { std::map::iterator it; - for (it = rootObj.begin(); it != rootObj.end(); it++) + for (it = rootObj.begin(); it != rootObj.end(); ++it) { std::string key = (*it).first; if (key == "index") @@ -132,7 +132,7 @@ struct Animation::AnimationImpl if (root->get(rootObj)) { std::map::iterator it; - for (it = rootObj.begin(); it != rootObj.end(); it++) + for (it = rootObj.begin(); it != rootObj.end(); ++it) { std::string key = (*it).first; @@ -145,7 +145,7 @@ struct Animation::AnimationImpl std::vector::iterator jt; for (jt = framesObj.begin(); - jt != framesObj.end(); jt++) + jt != framesObj.end(); ++jt) { if (*jt) { @@ -182,7 +182,7 @@ struct Animation::AnimationImpl void loadFromFile() { - std::string filePath = Animation::getPathToResource(getName()); + std::string filePath = Animation::getPath(getName()); Deserializer deserializer(filePath); @@ -196,7 +196,7 @@ struct Animation::AnimationImpl { std::map::iterator it; - for (it = rootObj.begin(); it != rootObj.end(); it++) + for (it = rootObj.begin(); it != rootObj.end(); ++it) { sequences.insert(std::pair((*it).first, Sequence((*it).second))); @@ -210,8 +210,8 @@ struct Animation::AnimationImpl * registers itself as a mippleton and then loads the animation data. */ - explicit AnimationData(const std::string& name) : - Mippleton(name) + explicit GlobalData(const std::string& name) : + Mippleton(name) { loadFromFile(); } @@ -224,8 +224,8 @@ struct Animation::AnimationImpl * Construction is intialization. */ - AnimationImpl(const std::string& name) : - data(AnimationData::retain(name), &AnimationData::release), + Impl(const std::string& name) : + data(GlobalData::getInstance(name)), currentSequence(0), frameCounter(0), frameIndex(0), @@ -241,7 +241,7 @@ struct Animation::AnimationImpl void startSequence(const std::string& name) { - std::map::iterator it; + std::map::iterator it; it = data->sequences.find(name); @@ -299,9 +299,9 @@ struct Animation::AnimationImpl } } - boost::shared_ptr data; ///< Internal data. + boost::shared_ptr data; ///< Internal data. - AnimationData::Sequence* currentSequence; ///< Active sequence. + GlobalData::Sequence* currentSequence; ///< Active sequence. unsigned frameCounter; ///< Current frame. unsigned frameIndex; ///< Index of current frame. Scalar timeAccum; ///< Time accumulation. @@ -311,7 +311,7 @@ struct Animation::AnimationImpl Animation::Animation(const std::string& name) : // pass through - impl_(new Animation::AnimationImpl(name)) {} + impl_(new Animation::Impl(name)) {} void Animation::startSequence(const std::string& name) @@ -343,9 +343,9 @@ unsigned Animation::getFrame() const * "animations" subdirectory of any of the searched directories. */ -std::string Animation::getPathToResource(const std::string& name) +std::string Animation::getPath(const std::string& name) { - return Resource::getPathToResource("animations/" + name + ".json"); + return Resource::getPath("animations/" + name + ".json"); }