1 #ifndef PARTICLE_SYSTEM_HPP_INCLUDED 2 #define PARTICLE_SYSTEM_HPP_INCLUDED 3 4 #include <boost/intrusive_ptr.hpp> 5 #include <boost/shared_ptr.hpp> 6 7 #include "formula_callable.hpp" 8 #include "geometry.hpp" 9 #include "variant.hpp" 10 11 class entity; 12 class particle_system; 13 typedef boost::intrusive_ptr<particle_system> particle_system_ptr; 14 typedef boost::intrusive_ptr<const particle_system> const_particle_system_ptr; 15 16 class particle_system_factory; 17 typedef boost::shared_ptr<const particle_system_factory> const_particle_system_factory_ptr; 18 19 class particle_system_factory 20 { 21 public: 22 static const_particle_system_factory_ptr create_factory(variant node); 23 24 virtual ~particle_system_factory(); 25 virtual particle_system_ptr create(const entity& e) const = 0; 26 }; 27 28 class particle_system : public game_logic::formula_callable 29 { 30 public: 31 virtual ~particle_system(); is_destroyed() const32 virtual bool is_destroyed() const { return false; } should_save() const33 virtual bool should_save() const { return true; } 34 virtual void process(const entity& e) = 0; 35 virtual void draw(const rect& area, const entity& e) const = 0; 36 set_type(const std::string & type)37 void set_type(const std::string& type) { type_ = type; } type() const38 const std::string& type() const { return type_; } 39 private: 40 std::string type_; 41 }; 42 43 #endif 44