* instances.
*/
-struct Animation::Impl
+class Animation::Impl
{
+ friend class Animation;
/**
* Contains "global" animation data for the various animations which get
* which wants to use these loaded sequences.
*/
- struct GlobalData : public Mippleton<GlobalData>
+ class Data : public Mippleton<Data>
{
+ friend class Impl;
+ friend class Mippleton<Data>;
+
/**
* A frame of an animation sequence. A frame is merely an index which
* presumably represents a "slide" or tile which should be displayed,
* frame map which is probably loaded within an animation file.
*/
- Frame(SerializablePtr root) :
+ Frame(SerializableP root) :
index(0),
duration(1.0)
{
- std::map<std::string,SerializablePtr> rootObj;
+ Serializable::Map rootObj;
if (root->get(rootObj))
{
- std::map<std::string,SerializablePtr>::iterator it;
+ Serializable::Map::iterator it;
for (it = rootObj.begin(); it != rootObj.end(); ++it)
{
* constructor which loads each individual frame.
*/
- Sequence(SerializablePtr root) :
+ Sequence(SerializableP root) :
delay(0.0),
loop(true)
{
- std::map<std::string,SerializablePtr> rootObj;
+ Serializable::Map rootObj;
if (root->get(rootObj))
{
- std::map<std::string,SerializablePtr>::iterator it;
+ Serializable::Map::iterator it;
for (it = rootObj.begin(); it != rootObj.end(); ++it)
{
std::string key = (*it).first;
if (key == "frames")
{
- std::vector<SerializablePtr> framesObj;
+ Serializable::Array framesObj;
if ((*it).second->get(framesObj))
{
- std::vector<SerializablePtr>::iterator jt;
+ Serializable::Array::iterator jt;
for (jt = framesObj.begin();
jt != framesObj.end(); ++jt)
Deserializer deserializer(filePath);
- SerializablePtr root = deserializer.deserialize();
+ SerializableP root = deserializer.deserialize();
if (root)
{
- std::map<std::string,SerializablePtr> rootObj;
+ Serializable::Map rootObj;
if (root->get(rootObj))
{
- std::map<std::string,SerializablePtr>::iterator it;
+ Serializable::Map::iterator it;
for (it = rootObj.begin(); it != rootObj.end(); ++it)
{
* registers itself as a mippleton and then loads the animation data.
*/
- explicit GlobalData(const std::string& name) :
- Mippleton<GlobalData>(name)
+ explicit Data(const std::string& name) :
+ Mippleton<Data>(name)
{
loadFromFile();
}
*/
Impl(const std::string& name) :
- data(GlobalData::retain(name), &GlobalData::release),
+ data(Data::getInstance(name)),
currentSequence(0),
frameCounter(0),
frameIndex(0),
void startSequence(const std::string& name)
{
- std::map<std::string,GlobalData::Sequence>::iterator it;
+ std::map<std::string,Data::Sequence>::iterator it;
it = data->sequences.find(name);
}
}
- boost::shared_ptr<GlobalData> data; ///< Internal data.
+ boost::shared_ptr<Data> 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.
};