diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-22 21:47:53 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-22 21:47:53 +0200 |
commit | ba5b70974c5dfa0be3105e72a0a012455b28e7a9 (patch) | |
tree | b79f9f46cc30eb2a1196b79392831af144fabc22 /src/simpleanimation.cpp | |
parent | 852ff45c35c422b5264487669934b392a8657465 (diff) | |
download | mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.gz mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.bz2 mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.xz mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.zip |
Made possible to separate the dye colors and channels
for particle effects.
It is now possible to write, for instance:
<particlefx>my-particle-file.xml|#cbcb78,345678</particlefx>
and in my-particle-file.xml:
...
<property image="my-image.png|W" />
...
This will permit the use (and reuse) of generic particle files.
Diffstat (limited to 'src/simpleanimation.cpp')
-rw-r--r-- | src/simpleanimation.cpp | 16 |
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), |