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,NONE,1.1 liquid.


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,NONE,1.1 liquid.hxx,NONE,1.1 Makefile.am,1.14,1.15
Date: 25 Sep 2002 17:21:41 -0000

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

Modified Files:
        Makefile.am 
Added Files:
        liquid.cxx liquid.hxx 
Log Message:
splitted Liquid


--- NEW FILE: liquid.cxx ---
//  $Id: liquid.cxx,v 1.1 2002/09/25 17:21:39 torangan Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  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.

#include "../col_map.hxx"
#include "../graphic_context.hxx"
#include "../pingus_resource.hxx"
#include "../world.hxx"
#include "../worldobjsdata/liquid_data.hxx"
#include "liquid.hxx"

namespace WorldObjs {

Liquid::Liquid (WorldObjsData::LiquidData* data_) :
  data(new WorldObjsData::LiquidData(*data_)),
  sur(PingusResource::load_surface(data->desc.res_name, "global"))
{
  if (!data->old_width_handling)
    data->width *= sur.get_width();

  counter.set_size(sur.get_num_frames());
  counter.set_speed(data->speed);
}

Liquid::~Liquid ()
{
  delete data;
}

float 
Liquid::get_z_pos () const
{
  return data->pos.z;
}

void
Liquid::on_startup ()
{
  CL_Surface sur = PingusResource::load_surface("Liquid/water_cmap", "global");

  for(int i=0; i < data->width; ++i)
    world->get_colmap()->put(sur,
                             static_cast<int>(data->pos.x + i),
                             static_cast<int>(data->pos.y),
                             Groundtype::GP_WATER);
}

void
Liquid::draw (GraphicContext& gc)
{
  for(int x = static_cast<int>(data->pos.x);
      x < data->pos.x + data->width;
      x += sur.get_width())
    gc.draw(sur, x, static_cast<int>(data->pos.y), static_cast<int>(counter));
  
  ++counter;
}

} // namespace WorldObjs

/* EOF */

--- NEW FILE: liquid.hxx ---
//  $Id: liquid.hxx,v 1.1 2002/09/25 17:21:39 torangan Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  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 HEADER_PINGUS_WORLDOBJS_LIQUID_HXX
#define HEADER_PINGUS_WORLDOBJS_LIQUID_HXX

#include <ClanLib/Display/Display/surface.h>
#include "../anim_counter.hxx"
#include "../worldobj.hxx"

namespace WorldObjsData {
class LiquidData;
}

namespace WorldObjs {

class Liquid : public WorldObj
{
private:
  WorldObjsData::LiquidData* const data;
  CL_Surface sur;
  AnimCounter counter;
  
public:
  CL_Surface colmap_sur;

  Liquid (WorldObjsData::LiquidData* data_);
 ~Liquid ();

  float get_z_pos () const;
  void  on_startup();
  void  draw      (GraphicContext& gc);
  
private:
  Liquid (const Liquid&);
  Liquid operator= (const Liquid&);
};

} // namespace WorldObjs

#endif

/* EOF */


Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile.am 21 Sep 2002 16:52:40 -0000      1.14
+++ Makefile.am 25 Sep 2002 17:21:39 -0000      1.15
@@ -30,6 +30,7 @@
         ice_block.cxx                  ice_block.hxx                  \
         info_box.cxx                   info_box.hxx                   \
        laser_exit.cxx                 laser_exit.hxx                 \
+       liquid.cxx                     liquid.hxx                     \
         rain_generator.hxx             rain_generator.cxx             \
        smasher.cxx                    smasher.hxx                    \
         snow_generator.hxx             snow_generator.cxx             \





reply via email to

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