X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FAnimation.cc;h=7eaec1947eb0a69f6d730a986890dbf92c268412;hp=39dcb5a40a8b643a7e98958e293ecdcfc7b30ac4;hb=fdfba4553433b9b2804c2772c7645211b828c2ea;hpb=5fa5f117f28922a7e539a432367960c1a61f837d diff --git a/src/Moof/Animation.cc b/src/Moof/Animation.cc index 39dcb5a..7eaec19 100644 --- a/src/Moof/Animation.cc +++ b/src/Moof/Animation.cc @@ -46,8 +46,9 @@ namespace Mf { * instances. */ -struct Animation::Impl +class Animation::Impl { + friend class Animation; /** * Contains "global" animation data for the various animations which get @@ -55,8 +56,11 @@ struct Animation::Impl * which wants to use these loaded sequences. */ - struct GlobalData : public Mippleton + class Data : public Mippleton { + friend class Impl; + friend class Mippleton; + /** * A frame of an animation sequence. A frame is merely an index which * presumably represents a "slide" or tile which should be displayed, @@ -73,15 +77,15 @@ struct Animation::Impl * frame map which is probably loaded within an animation file. */ - Frame(SerializablePtr root) : + Frame(SerializableP root) : index(0), duration(1.0) { - std::map rootObj; + Serializable::Map rootObj; if (root->get(rootObj)) { - std::map::iterator it; + Serializable::Map::iterator it; for (it = rootObj.begin(); it != rootObj.end(); ++it) { @@ -123,26 +127,26 @@ struct Animation::Impl * constructor which loads each individual frame. */ - Sequence(SerializablePtr root) : + Sequence(SerializableP root) : delay(0.0), loop(true) { - std::map rootObj; + Serializable::Map rootObj; if (root->get(rootObj)) { - std::map::iterator it; + Serializable::Map::iterator it; for (it = rootObj.begin(); it != rootObj.end(); ++it) { std::string key = (*it).first; if (key == "frames") { - std::vector framesObj; + Serializable::Array framesObj; if ((*it).second->get(framesObj)) { - std::vector::iterator jt; + Serializable::Array::iterator jt; for (jt = framesObj.begin(); jt != framesObj.end(); ++jt) @@ -186,15 +190,15 @@ struct Animation::Impl Deserializer deserializer(filePath); - SerializablePtr root = deserializer.deserialize(); + SerializableP root = deserializer.deserialize(); if (root) { - std::map rootObj; + Serializable::Map rootObj; if (root->get(rootObj)) { - std::map::iterator it; + Serializable::Map::iterator it; for (it = rootObj.begin(); it != rootObj.end(); ++it) { @@ -210,8 +214,8 @@ struct Animation::Impl * registers itself as a mippleton and then loads the animation data. */ - explicit GlobalData(const std::string& name) : - Mippleton(name) + explicit Data(const std::string& name) : + Mippleton(name) { loadFromFile(); } @@ -225,7 +229,7 @@ struct Animation::Impl */ Impl(const std::string& name) : - data(GlobalData::getInstance(name)), + data(Data::getInstance(name)), currentSequence(0), frameCounter(0), frameIndex(0), @@ -241,7 +245,7 @@ struct Animation::Impl void startSequence(const std::string& name) { - std::map::iterator it; + std::map::iterator it; it = data->sequences.find(name); @@ -299,13 +303,13 @@ struct Animation::Impl } } - boost::shared_ptr data; ///< Internal data. + boost::shared_ptr data; ///< Internal data. - GlobalData::Sequence* currentSequence; ///< Active sequence. - unsigned frameCounter; ///< Current frame. - unsigned frameIndex; ///< Index of current frame. - Scalar timeAccum; ///< Time accumulation. - Scalar frameDuration; ///< Scaled frame duration. + Data::Sequence* currentSequence; ///< Active sequence. + unsigned frameCounter; ///< Current frame. + unsigned frameIndex; ///< Index of current frame. + Scalar timeAccum; ///< Time accumulation. + Scalar frameDuration; ///< Scaled frame duration. };