pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.5,1.6 liquid.h


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.5,1.6 liquid.hxx,1.4,1.5 surface_background.cxx,1.5,1.6
Date: 18 Feb 2003 17:04:17 -0000

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

Modified Files:
        liquid.cxx liquid.hxx surface_background.cxx 
Log Message:
- added keep_aspect to surface backgrounds
- fixed anim bug in liquid


Index: liquid.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/liquid.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- liquid.cxx  1 Dec 2002 17:45:22 -0000       1.5
+++ liquid.cxx  18 Feb 2003 17:04:13 -0000      1.6
@@ -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 <iostream>
 #include "../col_map.hxx"
 #include "../graphic_context.hxx"
 #include "../pingus_resource.hxx"
@@ -28,7 +29,7 @@
 
 Liquid::Liquid (const WorldObjsData::LiquidData& data_) :
   data(new WorldObjsData::LiquidData(data_)),
-  sur(data->desc, data->speed)
+  sur(data->desc, 1000.0f/data->speed)
 {
   if (!data->old_width_handling)
     data->width *= sur.get_width();
@@ -67,9 +68,9 @@
 }
 
 void
-Liquid::update(float delta)
+Liquid::update()
 {
-  sur.update(delta);
+  sur.update();
 }
 
 } // namespace WorldObjs

Index: liquid.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/liquid.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- liquid.hxx  1 Dec 2002 17:45:22 -0000       1.4
+++ liquid.hxx  18 Feb 2003 17:04:13 -0000      1.5
@@ -44,7 +44,7 @@
   float get_z_pos () const;
   void  on_startup();
   void  draw      (GraphicContext& gc);
-  void  update(float delta);
+  void  update();
   
 private:
   Liquid (const Liquid&);

Index: surface_background.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/surface_background.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- surface_background.cxx      7 Oct 2002 23:04:06 -0000       1.5
+++ surface_background.cxx      18 Feb 2003 17:04:13 -0000      1.6
@@ -48,20 +48,47 @@
 
   if (background_manipulation_enabled)
     {
-      std::cout << "------ SurfaceBackground:: Manipulating background ------" 
<< std::endl;
       CL_Surface source_surface = PingusResource::load_surface(data->desc);
       
       CL_Canvas* canvas;
 
       // Scaling Code
       if (data->stretch_x && data->stretch_y)
-       canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), world->get_height());
+        {
+          canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), world->get_height());
+        }
       else if (data->stretch_x && !data->stretch_y)
-       canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), source_surface.get_height());
+        {
+          if (data->keep_aspect)
+            {
+              float aspect = 
source_surface.get_height()/float(source_surface.get_width());
+              canvas = Blitter::scale_surface_to_canvas(source_surface, 
+                                                        world->get_width(), 
+                                                        
int(world->get_width()*aspect));
+            }
+          else
+            {
+              canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
+            }
+        }
       else if (!data->stretch_x && data->stretch_y)
-       canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
+        {
+          if (data->keep_aspect)
+            {
+              float aspect = 
float(source_surface.get_width())/source_surface.get_height();
+              canvas = Blitter::scale_surface_to_canvas(source_surface,
+                                                        
int(world->get_height() * aspect),
+                                                        world->get_height());
+            }
+          else
+            {
+              canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
+            }
+        }
       else
-       canvas = Blitter::create_canvas(source_surface);
+        {
+          canvas = Blitter::create_canvas(source_surface);
+        }
 
       /* FIXME: fill_rect doesn't work with RGB images
         FIXME: seems to work fine with indexed images
@@ -79,7 +106,6 @@
        }
       
       bg_surface = CL_Surface(canvas, true);
-      std::cout << "Surface: " << bg_surface.get_width() << " " << 
bg_surface.get_height() << std::endl;
     }
   else
     {
@@ -90,12 +116,6 @@
   counter.set_size(bg_surface.get_num_frames());
   counter.set_speed(1.0);
 
-  if (verbose > 1)
-    {
-      std::cout << "Background: data->stretch_x: " << data->stretch_x << 
std::endl;
-      std::cout << "Background: data->stretch_y: " << data->stretch_y << 
std::endl;
-    }
-  
   timer.stop();
 }
 





reply via email to

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