void Stage::delete_particle_system(ParticleSystemID pid) { signal_particle_system_destroyed_(pid); particle_system(pid)->destroy_children(); ParticleSystemManager::manager_delete(pid); }
ParticleSystemID Stage::new_particle_system_with_parent_from_file(ActorID parent, const unicode& filename, bool destroy_on_completion) { ParticleSystemID new_id = new_particle_system(); auto ps = particle_system(new_id); ps->set_parent(parent); ps->set_destroy_on_completion(destroy_on_completion); window->loader_for(filename)->into(ps); return new_id; }
ParticleSystems::ParticleSystems(const FileReader& reader) : m_systems(), m_drawables() { std::string filename; Vector2f pos; reader.get("name", filename); reader.get("pos", pos); { // Load the ParticleSystems FileReader root_reader = FileReader::parse(Pathname(filename)); if(root_reader.get_name() != "particle-systems") { std::ostringstream msg; msg << "'" << filename << "' is not a particle-system file"; throw std::runtime_error(msg.str()); } std::vector<FileReader> sections = root_reader.get_sections(); for(std::vector<FileReader>::iterator i = sections.begin(); i != sections.end(); ++i) { if (i->get_name() == "particle-system") { boost::shared_ptr<ParticleSystem> particle_system(new ParticleSystem(*i)); particle_system->set_pos(pos); m_systems.push_back(particle_system); } } } for(Systems::iterator i = m_systems.begin(); i != m_systems.end(); ++i) { boost::shared_ptr<ParticleSystemDrawable> drawable(new ParticleSystemDrawable(**i)); m_drawables.push_back(drawable); Sector::current()->get_scene_graph().add_drawable(drawable); } }