pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src Makefile.am, 1.156, 1.157 capture_rec


From: Ingo Ruhnke
Subject: [Pingus-CVS] CVS: Games/Pingus/src Makefile.am, 1.156, 1.157 capture_rectangle.cxx, 1.16, 1.17 global_event.cxx, 1.14, 1.15 pingus_resource.cxx, 1.32, 1.33 playfield.cxx, 1.39, 1.40 spot_map.cxx, 1.30, 1.31 spot_map.hxx, 1.10, 1.11 sprite.cxx, 1.17, 1.18 sprite.hxx, 1.13, 1.14 story_screen.cxx, 1.24, 1.25 theme.cxx, 1.22, 1.23 theme_selector.cxx, 1.16, 1.17
Date: Wed, 22 Oct 2003 13:11:25 +0200

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv31952

Modified Files:
        Makefile.am capture_rectangle.cxx global_event.cxx 
        pingus_resource.cxx playfield.cxx spot_map.cxx spot_map.hxx 
        sprite.cxx sprite.hxx story_screen.cxx theme.cxx 
        theme_selector.cxx 
Log Message:
- some more stuff, compiles now, but doesn't link (as expected)

Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/Makefile.am,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- Makefile.am 21 Oct 2003 11:01:52 -0000      1.156
+++ Makefile.am 22 Oct 2003 11:11:22 -0000      1.157
@@ -268,12 +268,8 @@
 string_tokenizer.hxx \
 system.cxx \
 system.hxx \
-target_provider.cxx \
-target_provider.hxx \
 theme.cxx \
 theme.hxx \
-theme_selector.cxx \
-theme_selector.hxx \
 time_display.cxx \
 time_display.hxx \
 timer.cxx \

Index: capture_rectangle.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/capture_rectangle.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- capture_rectangle.cxx       21 Oct 2003 11:01:52 -0000      1.16
+++ capture_rectangle.cxx       22 Oct 2003 11:11:22 -0000      1.17
@@ -34,10 +34,10 @@
 CaptureRectangle::CaptureRectangle (ButtonPanel* arg_button_panel)
   : pingu(0),
     owner_id(0),
-    good(PingusResource::load_surface("Cursors/capgood", "game")),
-    bad(PingusResource::load_surface("Cursors/capbad",  "game")),
-    arrow_left(PingusResource::load_surface("Cursors/arrow_left",  "game")),
-    arrow_right(PingusResource::load_surface("Cursors/arrow_right", "game")),
+    good("Cursors/capgood", "game"),
+    bad("Cursors/capbad",  "game"),
+    arrow_left("Cursors/arrow_left",  "game"),
+    arrow_right("Cursors/arrow_right", "game"),
     button_panel(arg_button_panel),
     font(Fonts::courier_small)
 {

Index: global_event.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/global_event.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- global_event.cxx    21 Oct 2003 21:37:06 -0000      1.14
+++ global_event.cxx    22 Oct 2003 11:11:22 -0000      1.15
@@ -40,10 +40,11 @@
 void
 GlobalEvent::on_button_press(const CL_InputEvent& event)
 {
-  if (event.device.get_type() == CL_InputEvent::keyboard)
+  if (event.device.get_type() == CL_InputDevice::keyboard)
     {
-      switch (key.id)
+      switch (event.id)
        {
+#ifdef CLANLIB_0_6
          // F1 is the general console modifer key...
        case CL_KEY_PAGEUP:
          //if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
@@ -110,6 +111,7 @@
              exit (0);
            }
 
+#endif
        default:
          // console << "GlobalEvent: Unknown key pressed: " << key.id;
          break;

Index: pingus_resource.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingus_resource.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- pingus_resource.cxx 21 Oct 2003 21:37:06 -0000      1.32
+++ pingus_resource.cxx 22 Oct 2003 11:11:22 -0000      1.33
@@ -56,10 +56,6 @@
        ++i)
     delete i->second;
 
-  for (std::map<ResDescriptor, CL_Font*>::iterator i = font_map.begin();
-       i != font_map.end ();
-       ++i)
-    delete i->second;
   resource_map.clear();
   surface_map.clear();
   font_map.clear();
@@ -107,7 +103,7 @@
 PingusResource::load_sprite(const std::string& res_name, 
                             const std::string& datafile)
 {
-  CL_ResourceManager* res = get(res_name, datafile);
+  CL_ResourceManager* res = get(datafile);
   return CL_Sprite(res_name, res);
 }
 
@@ -262,7 +258,7 @@
     }
 }
 
-CL_Font*
+CL_Font
 PingusResource::load_font(const std::string& res_name,
                          const std::string& datafile)
 {
@@ -287,8 +283,8 @@
        {
        case ResDescriptor::RD_RESOURCE:
          try {
-           font = CL_Font::load(res_desc.res_name.c_str(),
-                                get(res_desc.datafile));
+           font = CL_Font(res_desc.res_name.c_str(),
+                           get(res_desc.datafile));
          } catch (CL_Error err) {
            pout << "PingusResource: " << err.message << std::endl
                 << "PingusResource: Couldn't load font: " << res_desc << 
std::endl;
@@ -299,15 +295,15 @@
 
        case ResDescriptor::RD_FILE:
          pout << "PingusResource: ResDescriptor::FILE not implemented" << 
std::endl;
-         return 0;
+         return CL_Font();
 
        case ResDescriptor::RD_AUTO:
          pout << "PingusResource: ResDescriptor::AUTO not implemented" << 
std::endl;
-         return 0;
+         return CL_Font();
 
        default:
          pout << "PingusResource: Unknown ResDescriptor::type: " << 
res_desc.type  << std::endl;
-         return 0;
+         return CL_Font();
        }
     }
 }
@@ -346,6 +342,7 @@
 PingusResource::get_mtime (const std::string& res_name,
                           const std::string& datafile)
 {
+#ifdef CLANLIB_0_6
   try
     {
       CL_ResourceManager* res_man = PingusResource::get(datafile);
@@ -370,6 +367,8 @@
       std::cout << "PingusResource::get_mtime: CL_Error: " << err.message << 
std::endl;
       return 0;
     }
+#endif
+  return 0;
 }
 
 } // namespace Pingus

Index: playfield.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/playfield.cxx,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- playfield.cxx       21 Oct 2003 21:37:06 -0000      1.39
+++ playfield.cxx       22 Oct 2003 11:11:22 -0000      1.40
@@ -121,18 +121,19 @@
 
        CL_Display::draw_line (mouse_x, mouse_y,
                              scroll_center_x, scroll_center_y,
-                             1.0f, 0.0f, 0.0f, 1.0f);
+                             Display::to_color(1.0f, 0.0f, 0.0f, 1.0f));
 
        CL_Display::draw_line (mouse_x, mouse_y,
                              scroll_center_x, scroll_center_y+15,
-                             0.0f, 0.0f, 1.0f, 1.0f);
+                             Display::to_color(0.0f, 0.0f, 1.0f, 1.0f));
 
        CL_Display::draw_line (mouse_x, mouse_y,
                              scroll_center_x + 15, scroll_center_y,
-                             0.0f, 1.0f, 1.0f, 1.0f);
+                             Display::to_color(0.0f, 1.0f, 1.0f, 1.0f));
+
        CL_Display::draw_line (mouse_x, mouse_y,
                              scroll_center_x - 15, scroll_center_y,
-                             1.0f, 1.0f, 0.0f, 1.0f);
+                             Display::to_color(1.0f, 1.0f, 0.0f, 1.0f));
     }
   UNUSED_ARG(gc);
 }

Index: spot_map.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- spot_map.cxx        21 Oct 2003 21:37:06 -0000      1.30
+++ spot_map.cxx        22 Oct 2003 11:11:22 -0000      1.31
@@ -25,6 +25,7 @@
 #include "blitter.hxx"
 #include "spot_map.hxx"
 #include "gettext.h"
+#include "canvas.hxx"
 #include "col_map.hxx"
 #include "math.hxx"
 
@@ -179,8 +180,8 @@
   else
     {
       // Trying to calc which parts of the tilemap needs to be drawn
-      int start_x = Math::max(0, display.x1/tile_size);
-      int start_y = Math::max(0, display.y1/tile_size);
+      int start_x = Math::max(0, display.left/tile_size);
+      int start_y = Math::max(0, display.top/tile_size);
       unsigned int tilemap_width  = display.get_width()  / tile_size + 1;
       unsigned int tilemap_height = display.get_height() / tile_size + 1;
 
@@ -233,15 +234,14 @@
 void
 PingusSpotMap::remove(CL_PixelBuffer* sprovider, int x, int y)
 {
+#ifdef CLANLIB_0_6
   // Get the start tile and end tile
   int start_x = Math::max(x / tile_size, 0);
   int start_y = Math::max(y / tile_size, 0);
   int end_x   = Math::min((x + sprovider->get_width()) / tile_size,
-                          static_cast<unsigned int>((width - 1) / tile_size));
+                          (width - 1) / tile_size);
   int end_y   = Math::min((y + sprovider->get_height()) / tile_size,
-                          static_cast<unsigned int>((height - 1) / tile_size));
-
-
+                          (height - 1) / tile_size);
 
   for(int ix = start_x; ix <= end_x; ++ix)
     {
@@ -249,7 +249,7 @@
        {
          if (!tile[ix][iy].is_empty())
            {
-             
put_alpha_surface(static_cast<CL_Canvas*>(tile[ix][iy].surface.get_provider()),
+             
put_alpha_surface(static_cast<CL_PixelBuffer*>(tile[ix][iy].surface.get_provider()),
                                sprovider,
                                x - (ix * tile_size), y - (iy * tile_size),
                                // FIXME, I am broken
@@ -259,12 +259,14 @@
            }
        }
     }
+#endif
 }
 
 void
-PingusSpotMap::put_alpha_surface(CL_Canvas* provider, CL_PixelBuffer* 
sprovider,
+PingusSpotMap::put_alpha_surface(CL_PixelBuffer* provider, CL_PixelBuffer* 
sprovider,
                                 int x, int y, int real_x_arg, int real_y_arg)
 {
+#ifdef CLANLIB_0_6
   int start_i;
   unsigned char* tbuffer; // Target buffer
   int twidth, theight, tpitch;
@@ -357,6 +359,7 @@
 
   sprovider->unlock();
   provider->unlock();
+#endif
 }
 
 void
@@ -384,9 +387,8 @@
        {
          if (tile[ix][iy].surface == 0)
            {
-             CL_Canvas* canvas;
-             //std::cout << "PingusSpotMap: Drawing to an emtpy tile: " << ix 
<< " " << iy << std::endl;
-             canvas = new CL_Canvas(tile_size, tile_size);
+             CL_PixelBuffer* canvas = Canvas::create_rgba8888(tile_size, 
tile_size);
+
              Blitter::clear_canvas(canvas);
 
              Blitter::put_surface(canvas, sprovider,
@@ -396,9 +398,11 @@
            }
          else
            {
-             
Blitter::put_surface(static_cast<CL_Canvas*>(tile[ix][iy].surface.get_provider()),
+#ifdef CLANLIB_0_6
+             
Blitter::put_surface(static_cast<CL_PixelBuffer*>(tile[ix][iy].surface.get_provider()),
                                   sprovider,
                                   x - (ix * tile_size), y - (iy * tile_size));
+#endif
            }
          /*
            CL_Surface s = CL_Surface::create(sprovider);

Index: spot_map.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/spot_map.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- spot_map.hxx        18 Oct 2003 23:17:27 -0000      1.10
+++ spot_map.hxx        22 Oct 2003 11:11:22 -0000      1.11
@@ -26,7 +26,7 @@
 #include "pingu_map.hxx"
 #include "worldobjsdata/groundpiece_data.hxx"
 
-class CL_Canvas;
+class CL_PixelBuffer;
 
 namespace Pingus {
 
@@ -95,7 +95,7 @@
 private:
   /** Low level version of the remove() call, acts on a single canvas
       instead on the complete map-tiles */
-  void put_alpha_surface(CL_Canvas* provider, CL_PixelBuffer* sprovider,
+  void put_alpha_surface(CL_PixelBuffer* provider, CL_PixelBuffer* sprovider,
                         int x, int y, int real_x, int real_y);
 
   /** Draw the collision map onto the screen */

Index: sprite.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/sprite.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- sprite.cxx  21 Oct 2003 21:37:06 -0000      1.17
+++ sprite.cxx  22 Oct 2003 11:11:22 -0000      1.18
@@ -33,9 +33,9 @@
 }
 
 Sprite::Sprite (const Sprite& sprite) 
-  : frame (sprite.frame),
+  : sprite(sprite.sprite),
+    frame (sprite.frame),
     frames_per_second (sprite.frames_per_second),
-    sur(sprite.sur),
     direction (sprite.direction),
     looptype (sprite.looptype),
     is_finished (sprite.is_finished),
@@ -45,31 +45,31 @@
 }
 
 Sprite&
-Sprite::operator= (const Sprite& sprite)
+Sprite::operator= (const Sprite& arg_sprite)
 {
-  if (this == &sprite)
+  if (this == &arg_sprite)
     return *this;
 
-  frame             = sprite.frame;
-  frames_per_second = sprite.frames_per_second;
-  sur               = sprite.sur;
-  direction         = sprite.direction;
-  looptype          = sprite.looptype;
-  is_finished       = sprite.is_finished;
-  x_align           = sprite.x_align;
-  y_align           = sprite.y_align;
+  sprite            = arg_sprite.sprite;
+  frame             = arg_sprite.frame;
+  frames_per_second = arg_sprite.frames_per_second;
+  direction         = arg_sprite.direction;
+  looptype          = arg_sprite.looptype;
+  is_finished       = arg_sprite.is_finished;
+  x_align           = arg_sprite.x_align;
+  y_align           = arg_sprite.y_align;
 
   return *this;
 }
 
-Sprite::Sprite (std::string arg_sur_name,
+Sprite::Sprite (std::string arg_sprite_name,
                std::string arg_datafile,
                float arg_frames_per_second,
                Sprite::Direction dir,
                LoopType arg_loop_type)
-  : frame (0.0f),
+  : sprite(PingusResource::load_sprite(arg_sprite_name, arg_datafile)),
+    frame (0.0f),
     frames_per_second (arg_frames_per_second),
-    sur(PingusResource::load_surface (arg_sur_name, arg_datafile)),
     direction (dir),
     looptype (arg_loop_type),
     is_finished (false),
@@ -77,7 +77,7 @@
 {
 }
 
-Sprite::Sprite (const CL_Surface& arg_sur,
+Sprite::Sprite (const CL_Sprite& arg_sprite,
                float arg_frames_per_second,
                Sprite::Direction dir,
                LoopType arg_loop_type)
@@ -88,7 +88,7 @@
     is_finished (false),
     x_align (0), y_align (0)
 {
-  sur = arg_sur;
+  sprite = arg_sprite;
 }
 
 Sprite::Sprite (const ResDescriptor& desc,
@@ -102,15 +102,16 @@
     is_finished (false),
     x_align (0), y_align (0)
 {
-  sur = PingusResource::load_surface (desc);
+  sprite = PingusResource::load_sprite(desc);
 }
 
 void
 Sprite::draw (int x, int y)
 {
-  //if (!sur)// FIXME: CL0.7
+  //if (!sprite)// FIXME: CL0.7
   //return;
 
+#ifdef CLANLIB_0_6
   // FIXME: HACK
   update (0.0f);
   //std::cout << "Frame: " << round(frame) << " " << frame << " " << 
max_frames () << std::endl;
@@ -118,18 +119,19 @@
   switch (direction)
     {
     case Sprite::NONE:
-      sur.draw(x + x_align, y + y_align, Math::round(frame));
+      sprite.draw(x + x_align, y + y_align, Math::round(frame));
       break;
     case Sprite::LEFT:
-      sur.draw(x + x_align, y + y_align, Math::round(frame));
+      sprite.draw(x + x_align, y + y_align, Math::round(frame));
       break;
     case Sprite::RIGHT:
-      sur.draw (x + x_align, y + y_align, Math::round(frame) + max_frames ());
+      sprite.draw (x + x_align, y + y_align, Math::round(frame) + max_frames 
());
       break;
     default:
       std::cout << "Direction: " << direction << std::endl;
       assert(0);
     }
+#endif
 }
 
 void
@@ -141,7 +143,8 @@
 void
 Sprite::draw(GraphicContext& gc, const Vector& pos)
 {
-  if (!sur)
+#ifdef CLANLIB_0_6
+  if (!sprite)
     return;
 
   // FIXME: HACK
@@ -154,17 +157,18 @@
     {
     case Sprite::NONE:
     case Sprite::LEFT:
-      gc.draw(sur, x + x_align, y + y_align, Math::round(frame));
+      gc.draw(sprite, x + x_align, y + y_align, Math::round(frame));
       break;
 
     case Sprite::RIGHT:
-      gc.draw(sur, x + x_align, y + y_align, Math::round(frame) + max_frames 
());
+      gc.draw(sprite, x + x_align, y + y_align, Math::round(frame) + 
max_frames ());
       break;
 
     default:
       std::cout << "Direction: " << direction << std::endl;
       assert(0);
     }
+#endif
 }
 
 void
@@ -177,15 +181,15 @@
 void
 Sprite::set_align_center ()
 {
-  x_align = -int(sur.get_width ())/2;
-  y_align = -int(sur.get_height ())/2;
+  x_align = -int(sprite.get_width ())/2;
+  y_align = -int(sprite.get_height ())/2;
 }
 
 void
 Sprite::set_align_center_bottom ()
 {
-  x_align = -int(sur.get_width ())/2;
-  y_align = -int(sur.get_height ());
+  x_align = -int(sprite.get_width ())/2;
+  y_align = -int(sprite.get_height ());
 }
 
 
@@ -194,7 +198,7 @@
 {
   ++frame;
 
-  if (Math::round(frame) >= int(sur.get_num_frames ()))
+  if (Math::round(frame) >= int(sprite.get_frame_count()))
     frame = 0;
 }
 
@@ -204,7 +208,7 @@
   --frame;
 
   if (Math::round(frame) < 0)
-    frame = sur.get_num_frames () - 1;
+    frame = sprite.get_frame_count() - 1;
 }
 
 
@@ -226,10 +230,10 @@
   switch (direction)
     {
     case NONE:
-      return sur.get_num_frames ();
+      return sprite.get_frame_count();
     case LEFT:
     case RIGHT:
-      return sur.get_num_frames ()/2;
+      return sprite.get_frame_count()/2;
     default:
       assert (0);
       return 0;
@@ -246,7 +250,7 @@
 void
 Sprite::update (float delta)
 {
-  if (!sur)
+  if (!sprite)
     return;
 
   // The sprite contains no frames, so we have nothing to update
@@ -305,10 +309,10 @@
   is_finished = false;
 }
 
-CL_Surface&
-Sprite::get_surface ()
+CL_Sprite&
+Sprite::get_sprite ()
 {
-  return sur;
+  return sprite;
 }
 
 void

Index: sprite.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/sprite.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sprite.hxx  18 Oct 2003 23:17:27 -0000      1.13
+++ sprite.hxx  22 Oct 2003 11:11:22 -0000      1.14
@@ -36,6 +36,7 @@
   typedef enum { ENDLESS, ONCE } LoopType;
 
 private:
+  CL_Sprite sprite;
   float frame;
   float frames_per_second;
   Direction direction;
@@ -63,7 +64,7 @@
          Direction dir = NONE,
          LoopType arg_loop_type = ENDLESS);
 
-  Sprite (const CL_Surface& sur,
+  Sprite (const CL_Sprite& sur,
          float frames_per_second = 10.0f,
          Direction dir = NONE,
          LoopType arg_loop_type = ENDLESS);
@@ -119,7 +120,7 @@
 
   /** Set the current direction of the surface, WARNING: Does only
       work in a few cases... FIXME: rewrite when
-      CL_Surface::get_num_xframes () exists
+      CL_Sprite::get_num_frames () exists
   @param dir Direction: LEFT, RIGHT, NONE */
   void set_direction (Sprite::Direction dir) { direction = dir; }
 
@@ -150,7 +151,7 @@
   void set_frame (int n);
 
   /// @return the surface which is used internally
-  CL_Surface& get_surface ();
+  CL_Sprite& get_sprite();
 };
 
 } // namespace Pingus

Index: story_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/story_screen.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- story_screen.cxx    21 Oct 2003 21:37:06 -0000      1.24
+++ story_screen.cxx    22 Oct 2003 11:11:22 -0000      1.25
@@ -170,7 +170,7 @@
 StoryScreen::on_startup()
 {
   //PingusSound::play_sound ("letsgo");
-  PingusSound::play_music("pingus-4.it", .7f);
+  Sound::PingusSound::play_music("pingus-4.it", .7f);
 }
 
 void

Index: theme.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/theme.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- theme.cxx   21 Oct 2003 21:37:06 -0000      1.22
+++ theme.cxx   22 Oct 2003 11:11:22 -0000      1.23
@@ -102,6 +102,7 @@
 int
 Theme::mark_level_at_point(int x, int y)
 {
+#ifdef CLANLIB_0_6
   preload ();
 
   int j = 0;
@@ -128,12 +129,14 @@
        }
       y_pos += font.get_height() + 4;
     }
+#endif
   return -1;
 }
 
 void
 Theme::draw_title()
 {
+#ifdef CLANLIB_0_6
   preload ();
 
   int x_center =  CL_Display::get_width() / 2;
@@ -219,6 +222,7 @@
       ++j;
       y_pos += font.get_height() + 4;
     }
+#endif
 }
 
 void

Index: theme_selector.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/theme_selector.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- theme_selector.cxx  21 Oct 2003 21:37:06 -0000      1.16
+++ theme_selector.cxx  22 Oct 2003 11:11:22 -0000      1.17
@@ -69,7 +69,9 @@
   font = Fonts::smallfont_h;
 }
 
-ListItem::ListItem (const ListItem& old) : label(old.label), font(new 
CL_Font(*(old.font)))
+ListItem::ListItem (const ListItem& old) 
+  : label(old.label),
+    font(old.font)
 {
 }
 





reply via email to

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