tibia-client/src/framework/graphics/particlesmanager.cpp

40 lines
1.0 KiB
C++
Raw Normal View History

2011-12-07 20:58:09 +01:00
#include "particlesmanager.h"
2011-12-13 21:06:22 +01:00
#include <framework/core/resourcemanager.h>
#include <framework/otml/otml.h>
2011-12-07 20:58:09 +01:00
ParticlesManager g_particlesManager;
2011-12-13 21:06:22 +01:00
bool ParticlesManager::load(const std::string& filename)
{
if(!g_resources.fileExists(filename))
return false;
try {
OTMLDocumentPtr doc = OTMLDocument::parse(filename);
//for(const OTMLNodePtr& child : doc->children())
//m_confsMap[child->tag()] = child->value();
return true;
} catch(Exception& e) {
logError("could not load configurations: ", e.what());
return false;
}
}
2011-12-07 20:58:09 +01:00
void ParticlesManager::add(ParticlesSystem particleSystem)
{
// check it has emitters
m_particlesSystems.push_back(particleSystem);
}
void ParticlesManager::render()
{
for(auto it = m_particlesSystems.begin(), end = m_particlesSystems.end(); it != end; ++it)
(*it).render();
}
void ParticlesManager::update()
{
for(auto it = m_particlesSystems.begin(), end = m_particlesSystems.end(); it != end; ++it)
(*it).update();
}