-converted remaining classes to GameObject
[supertux.git] / src / particlesystem.h
index 8efdf95..4f21a5c 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
 #ifndef SUPERTUX_PARTICLESYSTEM_H
 #define SUPERTUX_PARTICLESYSTEM_H
 
 #include <vector>
 #include "texture.h"
+#include "drawable.h"
+#include "game_object.h"
+
+class DisplayManager;
 
 /**
  * This is the base class for particle systems. It is responsible for storing a
  * initialize particles in the constructor and move them in the simulate
  * function.
  */
-class ParticleSystem
+class ParticleSystem : public GameObject, public Drawable
 {
 public:
-    ParticleSystem();
+    ParticleSystem(DisplayManager& displaymanager);
     virtual ~ParticleSystem();
     
-    void draw(float scrollx, float scrolly, int layer);
-
-    virtual void simulate(float elapsed_time) = 0;
+    virtual void draw(ViewPort& view, int layer);
 
 protected:
     class Particle
@@ -56,7 +59,7 @@ protected:
 
         float x, y;
         int layer;
-        texture_type* texture;
+        Surface* texture;
     };
     
     std::vector<Particle*> particles;
@@ -66,10 +69,13 @@ protected:
 class SnowParticleSystem : public ParticleSystem
 {
 public:
-    SnowParticleSystem();
+    SnowParticleSystem(DisplayManager& displaymanager);
     virtual ~SnowParticleSystem();
 
-    virtual void simulate(float elapsed_time);
+    virtual void action(float elapsed_time);
+
+    std::string type() const
+    { return "SnowParticleSystem"; }
     
 private:
     class SnowParticle : public Particle
@@ -78,16 +84,19 @@ private:
         float speed;
     };
     
-    texture_type snowimages[3];
+    Surface* snowimages[3];
 };
 
 class CloudParticleSystem : public ParticleSystem
 {
 public:
-    CloudParticleSystem();
+    CloudParticleSystem(DisplayManager& displaymanager);
     virtual ~CloudParticleSystem();
 
-    virtual void simulate(float elapsed_time);
+    virtual void action(float elapsed_time);
+
+    std::string type() const
+    { return "SnowParticleSystem"; }    
     
 private:
     class CloudParticle : public Particle
@@ -96,7 +105,7 @@ private:
         float speed;
     };
     
-    texture_type cloudimage;
+    Surface* cloudimage;
 };
 
 #endif