-void
-SnowParticleSystem::parse(const lisp::Lisp& reader)
-{
- reader.get("layer", layer);
-}
-
-void
-SnowParticleSystem::write(lisp::Writer& writer)
-{
- writer.start_list("particles-snow");
- writer.write_int("layer", layer);
- writer.end_list("particles-snow");
-}
-
-SnowParticleSystem::~SnowParticleSystem()
-{
- for(int i=0;i<3;++i)
- delete snowimages[i];
-}
-
-void SnowParticleSystem::action(float elapsed_time)
-{
- std::vector<Particle*>::iterator i;
- for(i = particles.begin(); i != particles.end(); ++i) {
- SnowParticle* particle = (SnowParticle*) *i;
- particle->pos.y += particle->speed * elapsed_time;
- if(particle->pos.y > screen->h) {
- particle->pos.y = fmodf(particle->pos.y , virtual_height);
- particle->pos.x = rand() % int(virtual_width);
- }
- }
-}
-
-CloudParticleSystem::CloudParticleSystem()
-{
- cloudimage = new Surface(datadir + "/images/shared/cloud.png", true);
-
- virtual_width = 2000.0;
-
- // create some random clouds
- for(size_t i=0; i<15; ++i) {
- CloudParticle* particle = new CloudParticle;
- particle->pos.x = rand() % int(virtual_width);
- particle->pos.y = rand() % int(virtual_height);
- particle->texture = cloudimage;
- particle->speed = -float(25 + rand() % 30);
-
- particles.push_back(particle);
- }
-}
-
-void
-CloudParticleSystem::parse(const lisp::Lisp& reader)
-{
- reader.get("layer", layer);
-}
-
-void
-CloudParticleSystem::write(lisp::Writer& writer)
-{
- writer.start_list("particles-clouds");
- writer.write_int("layer", layer);
- writer.end_list("particles-clouds");
-}
-
-CloudParticleSystem::~CloudParticleSystem()
-{
- delete cloudimage;
-}
-
-void CloudParticleSystem::action(float elapsed_time)
-{
- std::vector<Particle*>::iterator i;
- for(i = particles.begin(); i != particles.end(); ++i) {
- CloudParticle* particle = (CloudParticle*) *i;
- particle->pos.x += particle->speed * elapsed_time;
- }
-}