/**
* 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
{
/**
* which wants to use these loaded sequences.
*/
- struct AnimationData : public Mippleton<AnimationData>
+ struct GlobalData : public Mippleton<GlobalData>
{
/**
* A frame of an animation sequence. A frame is merely an index which
{
std::map<std::string,SerializablePtr>::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")
if (root->get(rootObj))
{
std::map<std::string,SerializablePtr>::iterator it;
- for (it = rootObj.begin(); it != rootObj.end(); it++)
+ for (it = rootObj.begin(); it != rootObj.end(); ++it)
{
std::string key = (*it).first;
std::vector<SerializablePtr>::iterator jt;
for (jt = framesObj.begin();
- jt != framesObj.end(); jt++)
+ jt != framesObj.end(); ++jt)
{
if (*jt)
{
void loadFromFile()
{
- std::string filePath = Animation::getPathToResource(getName());
+ std::string filePath = Animation::getPath(getName());
Deserializer deserializer(filePath);
{
std::map<std::string,SerializablePtr>::iterator it;
- for (it = rootObj.begin(); it != rootObj.end(); it++)
+ for (it = rootObj.begin(); it != rootObj.end(); ++it)
{
sequences.insert(std::pair<std::string,Sequence>((*it).first,
Sequence((*it).second)));
* registers itself as a mippleton and then loads the animation data.
*/
- explicit AnimationData(const std::string& name) :
- Mippleton<AnimationData>(name)
+ explicit GlobalData(const std::string& name) :
+ Mippleton<GlobalData>(name)
{
loadFromFile();
}
* Construction is intialization.
*/
- AnimationImpl(const std::string& name) :
- data(AnimationData::retain(name), &AnimationData::release),
+ Impl(const std::string& name) :
+ data(GlobalData::retain(name), &GlobalData::release),
currentSequence(0),
frameCounter(0),
frameIndex(0),
void startSequence(const std::string& name)
{
- std::map<std::string,AnimationData::Sequence>::iterator it;
+ std::map<std::string,GlobalData::Sequence>::iterator it;
it = data->sequences.find(name);
}
}
- boost::shared_ptr<AnimationData> data; ///< Internal data.
+ boost::shared_ptr<GlobalData> 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.
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)
* "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");
}