summaryrefslogtreecommitdiff
path: root/src/simpleanimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simpleanimation.cpp')
-rw-r--r--src/simpleanimation.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 24a17ce7..c6dc1efe 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -26,6 +26,7 @@
#include "log.h"
#include "resources/animation.h"
+#include "resources/dye.h"
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
@@ -39,13 +40,14 @@ SimpleAnimation::SimpleAnimation(Animation *animation):
{
}
-SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
+SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode,
+ const std::string& dyePalettes):
mAnimation(new Animation),
mAnimationTime(0),
mAnimationPhase(0),
mInitialized(false)
{
- initializeAnimation(animationNode);
+ initializeAnimation(animationNode, dyePalettes);
mCurrentFrame = mAnimation->getFrame(0);
}
@@ -116,13 +118,21 @@ Image *SimpleAnimation::getCurrentImage() const
return NULL;
}
-void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode)
+void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
+ const std::string& dyePalettes)
{
mInitialized = false;
if (!animationNode)
return;
+ std::string imagePath = XML::getProperty(animationNode,
+ "imageset", "");
+
+ // Instanciate the dye coloration.
+ if (!imagePath.empty() && !dyePalettes.empty())
+ Dye::instantiate(imagePath, dyePalettes);
+
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
XML::getProperty(animationNode, "width", 0),