diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-22 14:14:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-22 14:14:34 +0300 |
commit | da05d9dd98315378bdded216184294f376643191 (patch) | |
tree | ffc4b984c73c3bb68d26a1df6481634254075744 /src/particle | |
parent | ec856b2026c7ceecab5f74942bb36661d7c6ae67 (diff) | |
download | mv-da05d9dd98315378bdded216184294f376643191.tar.gz mv-da05d9dd98315378bdded216184294f376643191.tar.bz2 mv-da05d9dd98315378bdded216184294f376643191.tar.xz mv-da05d9dd98315378bdded216184294f376643191.zip |
Use resource manager as global variable.
Diffstat (limited to 'src/particle')
-rw-r--r-- | src/particle/particle.cpp | 4 | ||||
-rw-r--r-- | src/particle/particleemitter.cpp | 21 |
2 files changed, 8 insertions, 17 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index f270dcc79..9dee09754 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -301,8 +301,6 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, return nullptr; } - ResourceManager *const resman = ResourceManager::getInstance(); - // Parse particles for_each_xml_child_node(effectChildNode, rootNode) { @@ -337,7 +335,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, } if (!imageSrc.empty() && !dyePalettes.empty()) Dye::instantiate(imageSrc, dyePalettes); - Image *const img = resman->getImage(imageSrc); + Image *const img = resourceManager->getImage(imageSrc); newParticle = new ImageParticle(img); newParticle->setMap(mMap); diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp index 69593a0e5..af9b32fe4 100644 --- a/src/particle/particleemitter.cpp +++ b/src/particle/particleemitter.cpp @@ -109,10 +109,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - - ResourceManager *const resman - = ResourceManager::getInstance(); - mParticleImage = resman->getImage(image); + mParticleImage = resourceManager->getImage(image); } } else if (name == "subimage") @@ -124,13 +121,10 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - - ResourceManager *const resman - = ResourceManager::getInstance(); - Image *img = resman->getImage(image); + Image *img = resourceManager->getImage(image); if (img) { - mParticleImage = resman->getSubImage(img, + mParticleImage = resourceManager->getSubImage(img, XML::getProperty(propertyNode, "x", 0), XML::getProperty(propertyNode, "y", 0), XML::getProperty(propertyNode, "width", 0), @@ -363,17 +357,16 @@ ParticleEmitter::ParticleEmitter(const ParticleEmitter &o) ImageSet *ParticleEmitter::getImageSet(XmlNodePtrConst node) { - ResourceManager *const resman = ResourceManager::getInstance(); ImageSet *imageset = nullptr; const int subX = XML::getProperty(node, "subX", -1); if (subX != -1) { - Image *const img = resman->getImage(XML::getProperty( + Image *const img = resourceManager->getImage(XML::getProperty( node, "imageset", "")); if (!img) return nullptr; - Image *const img2 = resman->getSubImage(img, subX, + Image *const img2 = resourceManager->getSubImage(img, subX, XML::getProperty(node, "subY", 0), XML::getProperty(node, "subWidth", 0), XML::getProperty(node, "subHeight", 0)); @@ -383,7 +376,7 @@ ImageSet *ParticleEmitter::getImageSet(XmlNodePtrConst node) return nullptr; } - imageset = resman->getSubImageSet(img2, + imageset = resourceManager->getSubImageSet(img2, XML::getProperty(node, "width", 0), XML::getProperty(node, "height", 0)); img2->decRef(); @@ -391,7 +384,7 @@ ImageSet *ParticleEmitter::getImageSet(XmlNodePtrConst node) } else { - imageset = resman->getImageSet( + imageset = resourceManager->getImageSet( XML::getProperty(node, "imageset", ""), XML::getProperty(node, "width", 0), XML::getProperty(node, "height", 0)); |