pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/particles particle.cxx,1.3,1.4 partic


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/particles particle.cxx,1.3,1.4 particle.hxx,1.6,1.7 particle_holder.cxx,1.5,1.6 pingu_particle.cxx,1.3,1.4 pingu_particle.hxx,1.5,1.6 rain_particle.cxx,1.4,1.5 rain_particle.hxx,1.4,1.5
Date: 29 Sep 2002 20:45:33 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/particles
In directory dark:/tmp/cvs-serv31799/particles

Modified Files:
        particle.cxx particle.hxx particle_holder.cxx 
        pingu_particle.cxx pingu_particle.hxx rain_particle.cxx 
        rain_particle.hxx 
Log Message:
- fixed bug in the particle drawing
- 'fixed' bridger bug, well worked around it

Index: particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/particle.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- particle.cxx        4 Sep 2002 14:55:12 -0000       1.3
+++ particle.cxx        29 Sep 2002 20:45:31 -0000      1.4
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include "../graphic_context.hxx"
 #include "particle.hxx"
 
 Particle::Particle()
@@ -59,16 +60,9 @@
 }
 
 void
-Particle::draw_offset(int ofx, int ofy, float s)
+Particle::draw (GraphicContext& gc)
 {
-  if (s == 1.0) {
-    surface.put_screen((int)pos.x + ofx, (int)pos.y + ofy);
-  } else {
-    int width  = (int)(surface.get_width() * s);
-    int height = (int)(surface.get_height() * s);
-    surface.put_screen((int)((pos.x + ofx) * s) - width/2, (int)((pos.y + ofy) 
* s) - height/2,
-                      width, height);
-  }
+  gc.draw (surface, pos);
 }
 
 bool

Index: particle.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/particle.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- particle.hxx        28 Sep 2002 11:52:25 -0000      1.6
+++ particle.hxx        29 Sep 2002 20:45:31 -0000      1.7
@@ -24,6 +24,8 @@
 #include "../vector.hxx"
 #include <ClanLib/Display/Display/surface.h>
 
+class GraphicContext;
+
 class Particle
 {
 protected:
@@ -56,7 +58,7 @@
   virtual void update (float delta);
 
   /// Draw the particle with the correct zoom resize
-  virtual void draw_offset (int, int, float);
+  virtual void draw (GraphicContext& gc);
   
 private:
   Particle (const Particle&);

Index: particle_holder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/particle_holder.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- particle_holder.cxx 28 Sep 2002 11:52:26 -0000      1.5
+++ particle_holder.cxx 29 Sep 2002 20:45:31 -0000      1.6
@@ -53,24 +53,12 @@
 }
 
 void
-ParticleHolder::draw_offset (int x, int y, float s) // const
-{
-  // FIXME: obsolete
-  for(std::list<Particle*>::iterator i = this->begin(); i != this->end(); ++i) 
-    { 
-      (*i)->draw_offset(x, y, s);
-    }
-}
-
-void
 ParticleHolder::draw (GraphicContext& gc) // const
 {
   for(std::list<Particle*>::iterator i = this->begin(); i != this->end(); ++i) 
     { 
       // FIXME: ugly... should use gc instead
-      (*i)->draw_offset (int(gc.get_x_offset () + (gc.get_width ()/2)), 
-                        int(gc.get_y_offset () + (gc.get_height ()/2)), 
-                        gc.get_zoom ());
+      (*i)->draw(gc);
     }
 }
 

Index: pingu_particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/pingu_particle.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pingu_particle.cxx  4 Sep 2002 14:55:12 -0000       1.3
+++ pingu_particle.cxx  29 Sep 2002 20:45:31 -0000      1.4
@@ -66,8 +66,9 @@
   livetime = 50 + (rand() % 25);
 }
 
+#if 0
 void
-PinguParticle::draw_offset(int ofx, int ofy, float /*s*/)
+PinguParticle::draw (GraphicContext& gc)
 {
   surface.put_screen(int(pos.x + ofx), int(pos.y + ofy));
   /* Particle resizeing is disabled, because it is to slow
@@ -81,7 +82,7 @@
   }
   */
 }
-
+#endif
 void
 PinguParticle::update(float /*delta*/)
 {

Index: pingu_particle.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/pingu_particle.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pingu_particle.hxx  27 Sep 2002 11:26:49 -0000      1.5
+++ pingu_particle.hxx  29 Sep 2002 20:45:31 -0000      1.6
@@ -35,7 +35,7 @@
   PinguParticle(int x, int y, float x_a, float y_a);
   
   void init(int x, int y, float x_a, float y_a);
-  void draw_offset(int ofx, int ofy, float s);
+  //void draw (GraphicContext& gc);
   void update(float delta);
   
 private:

Index: rain_particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/rain_particle.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rain_particle.cxx   16 Sep 2002 20:31:09 -0000      1.4
+++ rain_particle.cxx   29 Sep 2002 20:45:31 -0000      1.5
@@ -23,6 +23,7 @@
 #include "../col_map.hxx"
 #include "../worldobj.hxx"
 #include "rain_particle.hxx"
+#include "../graphic_context.hxx"
 
 CL_Surface RainParticle::rain1_surf;
 CL_Surface RainParticle::rain2_surf;
@@ -62,7 +63,7 @@
 }
 
 void
-RainParticle::draw_offset(int x_of, int y_of, float s)
+RainParticle::draw(GraphicContext& gc)
 {
   if (!splash)
     {
@@ -71,12 +72,11 @@
       else
        surface = rain1_surf;     
 
-      Particle::draw_offset(x_of, y_of - rain1_surf.get_height(), s);
+      gc.draw(surface, int(pos.x), int(pos.y - rain1_surf.get_height()));
     }
   else
     {
-      rain_splash.put_screen(int(pos.x + x_of),
-                            int(pos.y + y_of)); 
+      gc.draw(rain_splash, pos);
     }
 }
 

Index: rain_particle.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/rain_particle.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rain_particle.hxx   27 Sep 2002 11:26:49 -0000      1.4
+++ rain_particle.hxx   29 Sep 2002 20:45:31 -0000      1.5
@@ -40,9 +40,9 @@
   RainParticle(int, int);
   virtual ~RainParticle();
 
-  virtual void draw_offset(int, int, float);
-  virtual void update(float delta);
-  virtual bool is_alive();
+  void draw(GraphicContext& gc);
+  void update(float delta);
+  bool is_alive();
   
 private:
   RainParticle (const RainParticle&);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]