4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
21 #define SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
25 #include "video/surface.hpp"
26 #include "game_object.hpp"
27 #include "serializable.hpp"
29 #include "math/vector.hpp"
38 * This is an alternative class for particle systems. It is responsible for storing a
39 * set of particles with each having an x- and y-coordinate the number of the
40 * layer where it should be drawn and a texture.
41 * This version of the particle system class doesn't use virtual screen coordinates,
42 * but Interactive ones. Particle systems which need Interactive levels coordinates, such
43 * as rain, should be implemented here.
44 * Classes that implement a particle system should subclass from this class,
45 * initialize particles in the constructor and move them in the simulate
48 class ParticleSystem_Interactive : public GameObject
51 ParticleSystem_Interactive();
52 virtual ~ParticleSystem_Interactive();
54 virtual void draw(DrawingContext& context);
69 std::vector<Particle*> particles;
70 float virtual_width, virtual_height;
71 int collision(Particle* particle, Vector movement);
74 class RainParticleSystem : public ParticleSystem_Interactive, public Serializable
78 virtual ~RainParticleSystem();
80 void parse(const lisp::Lisp& lisp);
81 void write(lisp::Writer& writer);
83 virtual void update(float elapsed_time);
85 std::string type() const
86 { return "RainParticleSystem"; }
89 class RainParticle : public Particle
95 Surface* rainimages[2];
98 class CometParticleSystem : public ParticleSystem_Interactive, public Serializable
101 CometParticleSystem();
102 virtual ~CometParticleSystem();
104 void parse(const lisp::Lisp& lisp);
105 void write(lisp::Writer& writer);
107 virtual void update(float elapsed_time);
109 std::string type() const
110 { return "CometParticleSystem"; }
113 class CometParticle : public Particle
119 Surface* cometimages[2];