pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/input double_button.cxx,NONE,1.1 doub


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input double_button.cxx,NONE,1.1 double_button.hxx,NONE,1.1 joystick_scroller.cxx,NONE,1.1 joystick_scroller.hxx,NONE,1.1 mouse_scroller.cxx,NONE,1.1 mouse_scroller.hxx,NONE,1.1 triple_button.cxx,NONE,1.1 triple_button.hxx,NONE,1.1 Makefile.am,1.14,1.15 axis_pointer.cxx,1.4,1.5 axis_pointer.hxx,1.4,1.5 axis_scroller.cxx,1.1,1.2 button_axis.cxx,1.3,1.4 button_axis.hxx,1.2,1.3 inverted_axis.cxx,1.2,1.3 inverted_axis.hxx,1.3,1.4 mouse_axis.hxx,1.3,1.4 multiple_axis.cxx,1.1,1.2 multiple_axis.hxx,1.1,1.2 multiple_button.cxx,1.2,1.3 multiple_button.hxx,1.3,1.4 multiple_pointer.cxx,1.2,1.3 multiple_pointer.hxx,1.2,1.3
Date: 11 Jul 2002 14:51:12 -0000

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

Modified Files:
        Makefile.am axis_pointer.cxx axis_pointer.hxx 
        axis_scroller.cxx button_axis.cxx button_axis.hxx 
        inverted_axis.cxx inverted_axis.hxx mouse_axis.hxx 
        multiple_axis.cxx multiple_axis.hxx multiple_button.cxx 
        multiple_button.hxx multiple_pointer.cxx multiple_pointer.hxx 
Added Files:
        double_button.cxx double_button.hxx joystick_scroller.cxx 
        joystick_scroller.hxx mouse_scroller.cxx mouse_scroller.hxx 
        triple_button.cxx triple_button.hxx 
Log Message:
some new classes, some bugfixes


--- NEW FILE: double_button.cxx ---
//  $Id: double_button.cxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 "double_button.hxx"

namespace Input {

  DoubleButton::DoubleButton (Button* button1_, Button* button2_) : 
button1(button1_), button2(button2_),
                                                                    
first_pressed(false), ignore_second(false)
  {
  }

  DoubleButton::~DoubleButton ()
  {
    delete button1;
    delete button2;
  }

  void
  DoubleButton::update (float delta)
  {
    button1->update(delta);
    button2->update(delta);
    
    if (button1->is_pressed())
      {
        if (!first_pressed)
          {
            first_pressed = true;
            ignore_second = button2->is_pressed();
          }
      }
    else
      {
        first_pressed = false;
        ignore_second = true;
      }
  }
  
  bool
  DoubleButton::is_pressed ()
  {
    return ( ! ignore_second && first_pressed && button2->is_pressed());
  }
  
}

/* EOF */

--- NEW FILE: double_button.hxx ---
//  $Id: double_button.hxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_INPUT_DOUBLE_BUTTON_HXX
#define HEADER_PINGUS_INPUT_DOUBLE_BUTTON_HXX

#include "button.hxx"

namespace Input {

  class DoubleButton : public Button {
  
    private:
      Button* button1;
      Button* button2;
      bool    first_pressed;
      bool    ignore_second;
      
    public:
    
      DoubleButton (Button* button1_, Button* button2_);
     ~DoubleButton ();

      virtual bool is_pressed ();
      virtual void update (float delta);
  };
}

#endif

/* EOF */

--- NEW FILE: joystick_scroller.cxx ---
//  $Id: joystick_scroller.cxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 "joystick_axis.hxx"
#include "joystick_scroller.hxx"

namespace Input {

  JoystickScroller::JoystickScroller (int id_, float speed_) : id(id_), 
speed(speed_)
  {
    axis1 = new JoystickAxis(id, 0, 0);
    axis2 = new JoystickAxis(id, 1, 90);
  }
  
  JoystickScroller::~JoystickScroller ()
  {
    delete axis1;
    delete axis2;
  }
  
  float
  JoystickScroller::get_x_delta ()
  {
    return axis1->get_pos() * speed;
  }
  
  float
  JoystickScroller::get_y_delta ()
  {
    return axis2->get_pos() * speed;
  }
  
  void
  JoystickScroller::get_delta (float& x, float& y)
  {
    x = axis1->get_pos() * speed;
    y = axis2->get_pos() * speed;
  }
  
  void
  JoystickScroller::update (float delta)
  {
    axis1->update(delta);
    axis2->update(delta);
  }
}

/* EOF */


--- NEW FILE: joystick_scroller.hxx ---
//  $Id: joystick_scroller.hxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_INPUT_JOYSTICK_SCROLLER_HXX
#define HEADER_PINGUS_INPUT_JOYSTICK_SCROLLER_HXX

#include "scroller.hxx"

namespace Input {

  class Axis;

  class JoystickScroller : public Scroller {
    private:
      int   id;
      Axis* axis1;
      Axis* axis2;
      float speed;
      
    public:
      JoystickScroller (int id_, float speed_);
     ~JoystickScroller ();
      
      float get_x_delta ();
      float get_y_delta ();
      
      void  get_delta (float& x, float& y);
      
      void  update (float delta);
  };
}

#endif

/* EOF */

--- NEW FILE: mouse_scroller.cxx ---
//  $Id: mouse_scroller.cxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 <ClanLib/Display/Input/input.h>
#include <ClanLib/Display/Input/inputdevice.h>
#include <ClanLib/Display/Input/inputcursor.h>
#include "mouse_scroller.hxx"

namespace Input {

  float
  MouseScroller::get_x_delta ()
  {
    return CL_Input::pointers[0]->get_cursor(0)->get_x() - old_x;
  }
  
  float
  MouseScroller::get_y_delta ()
  {
    return CL_Input::pointers[0]->get_cursor(0)->get_x() - old_y;
  }
  
  void
  MouseScroller::get_delta (float& x, float& y)
  {
    x = CL_Input::pointers[0]->get_cursor(0)->get_x() - old_x;
    y = CL_Input::pointers[0]->get_cursor(0)->get_y() - old_y;
  }
  
  void
  MouseScroller::update (float)
  {
    old_x = CL_Input::pointers[0]->get_cursor(0)->get_x();
    old_y = CL_Input::pointers[0]->get_cursor(0)->get_y();
  }
}

/* EOF */


--- NEW FILE: mouse_scroller.hxx ---
//  $Id: mouse_scroller.hxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_INPUT_MOUSE_SCROLLER_HXX
#define HEADER_PINGUS_INPUT_MOUSE_SCROLLER_HXX

#include "scroller.hxx"

namespace Input {

  class MouseScroller : public Scroller {
    private:
      float old_x;
      float old_y;
      
    public:
      float get_x_delta ();
      float get_y_delta ();
      
      void  get_delta (float& x, float& y);
      
      void  update (float);
  };
}

#endif

/* EOF */

--- NEW FILE: triple_button.cxx ---
//  $Id: triple_button.cxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 "triple_button.hxx"

namespace Input {

  TripleButton::TripleButton(Button* button1_, Button* button2_, Button* 
button3_) : button1(button1_), button2(button2_), button3(button3_),
                                                                                
     first_second_pressed(false), ignore_third(false)
  {
  }

  TripleButton::~TripleButton ()
  {
    delete button1;
    delete button2;
    delete button3;
  }

  void
  TripleButton::update(float delta)
  {
    button1->update(delta);
    button2->update(delta);
    button3->update(delta);
  
    if (button1->is_pressed() && button2->is_pressed())
      {
        if (!first_second_pressed)
          {
            first_second_pressed = true;
            ignore_third = button3->is_pressed();
          }
      }
    else
      {
        first_second_pressed = false;
        ignore_third         = true;
      }
  }
  
  bool
  TripleButton::is_pressed()
  {
    return ( ! ignore_third && first_second_pressed && button3->is_pressed());
  }
  
}

/* EOF */

--- NEW FILE: triple_button.hxx ---
//  $Id: triple_button.hxx,v 1.1 2002/07/11 14:51:10 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_INPUT_TRIPLE_BUTTON_HXX
#define HEADER_PINGUS_INPUT_TRIPLE_BUTTON_HXX

#include "button.hxx"

namespace Input {

  class TripleButton : public Button {
  
    private:
      Button* button1;
      Button* button2;
      Button* button3;
      bool    first_second_pressed;
      bool    ignore_third;
      
    public:
      TripleButton (Button* button1_, Button* button2_, Button* button3_);
     ~TripleButton ();

      virtual bool is_pressed ();
      virtual void update (float delta);
  };
}

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile.am 11 Jul 2002 12:36:27 -0000      1.14
+++ Makefile.am 11 Jul 2002 14:51:10 -0000      1.15
@@ -28,6 +28,7 @@
        button_event.hxx \
        button_factory.hxx button_factory.cxx \
        controller.hxx controller.cxx \
+       double_button.hxx double_button.cxx \
        dummy_axis.hxx \
        dummy_button.hxx \
        dummy_pointer.hxx \
@@ -35,11 +36,13 @@
        inverted_axis.hxx inverted_axis.cxx \
        joystick_axis.hxx joystick_axis.cxx \
         joystick_button.hxx joystick_button.cxx \
+       joystick_scroller.hxx joystick_scroller.cxx \
         key_button.hxx key_button.cxx \
         key_helper.hxx key_helper.cxx \
        mouse_axis.hxx mouse_axis.cxx \
        mouse_button.hxx mouse_button.cxx \
         mouse_pointer.hxx mouse_pointer.cxx \
+       mouse_scroller.hxx mouse_scroller.cxx \
        multiple_axis.hxx multiple_axis.cxx \
        multiple_button.hxx multiple_button.cxx \
        multiple_pointer.hxx multiple_pointer.cxx \
@@ -47,6 +50,7 @@
        pointer_event.hxx \
        pointer_factory.hxx pointer_factory.cxx \
        pointer_scroller.hxx pointer_scroller.cxx \
-       scroller.hxx
+       scroller.hxx \
+       triple_button.hxx triple_button.cxx
 
 # EOF #

Index: axis_pointer.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_pointer.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- axis_pointer.cxx    9 Jul 2002 17:00:10 -0000       1.4
+++ axis_pointer.cxx    11 Jul 2002 14:51:10 -0000      1.5
@@ -23,11 +23,17 @@
 
 namespace Input
 {
-  AxisPointer::AxisPointer(float speed_, const std::vector<Axis*>& axes_) : 
speed(speed_), axes(axes_)
+  AxisPointer::AxisPointer (float speed_, const std::vector<Axis*>& axes_) : 
speed(speed_), axes(axes_)
   {
     assert(axes.size() >= 2);
   }
 
+  AxisPointer::~AxisPointer ()
+  {
+    for (std::vector<Axis*>::const_iterator it = axes.begin(); it != 
axes.end(); it++)
+      delete *it;
+  }
+
   float
   AxisPointer::get_x_pos ()
   {
@@ -52,6 +58,8 @@
   {
     for (std::vector<Axis*>::const_iterator it = axes.begin(); it != 
axes.end(); it++)
       {
+        (*it)->update(delta);
+       
         x_pos += cos((*it)->get_angle()) * speed * delta;
         y_pos += sin((*it)->get_angle()) * speed * delta;
       } 

Index: axis_pointer.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_pointer.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- axis_pointer.hxx    9 Jul 2002 17:00:10 -0000       1.4
+++ axis_pointer.hxx    11 Jul 2002 14:51:10 -0000      1.5
@@ -40,7 +40,8 @@
       
     public:
 
-      AxisPointer(float speed, const std::vector<Axis*>& axes_);
+      AxisPointer (float speed, const std::vector<Axis*>& axes_);
+     ~AxisPointer ();
 
       virtual float get_x_pos ();
       virtual float get_y_pos ();

Index: axis_scroller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_scroller.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- axis_scroller.cxx   11 Jul 2002 12:36:15 -0000      1.1
+++ axis_scroller.cxx   11 Jul 2002 14:51:10 -0000      1.2
@@ -23,7 +23,6 @@
 namespace Input {
 
   AxisScroller::AxisScroller (Axis* axis1_, Axis* axis2_, float speed_) : 
axis1(axis1_), axis2(axis2_), speed(speed_)
-                                                  
   {
   }
   

Index: button_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button_axis.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- button_axis.cxx     5 Jul 2002 11:02:47 -0000       1.3
+++ button_axis.cxx     11 Jul 2002 14:51:10 -0000      1.4
@@ -22,8 +22,8 @@
 
 namespace Input
 {
-  ButtonAxis::ButtonAxis(float angle_, Button* button1_, Button* button2_) : 
-                         angle(angle_), button1(button1_), button2(button2_) 
+  ButtonAxis::ButtonAxis (float angle_, Button* button1_, Button* button2_) : 
+                          angle(angle_), button1(button1_), button2(button2_) 
   {
     if (angle < 0)
       angle = (static_cast<int>(angle) % 360) + 360;
@@ -31,6 +31,12 @@
       angle = static_cast<int>(angle) % 360;
   }
 
+  ButtonAxis::~ButtonAxis ()
+  {
+    delete button1;
+    delete button2;
+  }
+
   float
   ButtonAxis::get_pos ()
   {
@@ -50,8 +56,10 @@
   }
   
   void
-  ButtonAxis::update(float)
+  ButtonAxis::update(float delta)
   {
+    button1->update(delta);
+    button2->update(delta);
   }
 }
 

Index: button_axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button_axis.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- button_axis.hxx     9 Jul 2002 17:00:10 -0000       1.2
+++ button_axis.hxx     11 Jul 2002 14:51:10 -0000      1.3
@@ -38,7 +38,8 @@
     
   public:
   
-    ButtonAxis(float angle_, Button* button1_, Button* button2_);
+    ButtonAxis (float angle_, Button* button1_, Button* button2_);
+   ~ButtonAxis ();
   
     virtual float get_pos ();
     virtual float get_angle ();

Index: inverted_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/inverted_axis.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- inverted_axis.cxx   5 Jul 2002 10:06:20 -0000       1.2
+++ inverted_axis.cxx   11 Jul 2002 14:51:10 -0000      1.3
@@ -21,9 +21,14 @@
 
 namespace Input
 {
-  InvertedAxis::InvertedAxis(Axis* axis_) : axis(axis_)
+  InvertedAxis::InvertedAxis (Axis* axis_) : axis(axis_)
   {
     angle = (static_cast<int>(axis->get_angle()) + 180) % 360;
+  }
+
+  InvertedAxis::~InvertedAxis ()
+  {
+    delete axis;
   }
 
   float

Index: inverted_axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/inverted_axis.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- inverted_axis.hxx   9 Jul 2002 17:00:10 -0000       1.3
+++ inverted_axis.hxx   11 Jul 2002 14:51:10 -0000      1.4
@@ -31,7 +31,8 @@
     float angle;
     
   public:
-    InvertedAxis(Axis* axis_);
+    InvertedAxis (Axis* axis_);
+   ~InvertedAxis ();
   
     virtual float get_pos ();
     virtual float get_angle ();

Index: mouse_axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/mouse_axis.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mouse_axis.hxx      11 Jul 2002 11:23:45 -0000      1.3
+++ mouse_axis.hxx      11 Jul 2002 14:51:10 -0000      1.4
@@ -22,8 +22,8 @@
 
 #include "axis.hxx"
 
-namespace Input
-{
+namespace Input {
+
   class MouseAxis : public Axis {
 
     private:

Index: multiple_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_axis.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- multiple_axis.cxx   10 Jul 2002 11:21:53 -0000      1.1
+++ multiple_axis.cxx   11 Jul 2002 14:51:10 -0000      1.2
@@ -21,13 +21,19 @@
 
 namespace Input
 {
-  MultipleAxis::MultipleAxis(float angle_, const std::vector<Axis*>& axes_) : 
-                             angle(angle_), axes(axes_)
+  MultipleAxis::MultipleAxis (float angle_, const std::vector<Axis*>& axes_) : 
+                              angle(angle_), axes(axes_)
   {
     if (angle < 0)
       angle = (static_cast<int>(angle) % 360) + 360;
     else if (angle > 360)
       angle = static_cast<int>(angle) % 360;
+  }
+
+  MultipleAxis::~MultipleAxis ()
+  {
+    for (std::vector<Axis*>::const_iterator it = axes.begin(); it != 
axes.end(); it++)
+      delete *it;
   }
 
   float

Index: multiple_axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_axis.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- multiple_axis.hxx   10 Jul 2002 11:21:53 -0000      1.1
+++ multiple_axis.hxx   11 Jul 2002 14:51:10 -0000      1.2
@@ -33,7 +33,8 @@
         
   public:
   
-    MultipleAxis(float angle_, const std::vector<Axis*>& axes_);
+    MultipleAxis (float angle_, const std::vector<Axis*>& axes_);
+   ~MultipleAxis ();
   
     virtual float get_pos ();
     virtual float get_angle ();

Index: multiple_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_button.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- multiple_button.cxx 9 Jul 2002 15:03:20 -0000       1.2
+++ multiple_button.cxx 11 Jul 2002 14:51:10 -0000      1.3
@@ -21,17 +21,25 @@
 
 namespace Input {
 
-  MultipleButton::MultipleButton(const std::vector<Button*>& buttons_) : 
buttons(buttons_) { }
+  MultipleButton::MultipleButton (const std::vector<Button*>& buttons_) : 
buttons(buttons_)
+  {
+  }
+
+  MultipleButton::~MultipleButton ()
+  {
+    for (std::vector<Button*>::iterator it = buttons.begin(); it != 
buttons.end(); it++)
+      delete *it;
+  }
 
   void
-  MultipleButton::update(float delta)
+  MultipleButton::update (float delta)
   {
     for (std::vector<Button*>::iterator it = buttons.begin(); it != 
buttons.end(); it++)
       (*it)->update(delta);
   }
   
   bool
-  MultipleButton::is_pressed()
+  MultipleButton::is_pressed ()
   {
     for (std::vector<Button*>::iterator it = buttons.begin(); it != 
buttons.end(); it++)
       if ((*it)->is_pressed())

Index: multiple_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_button.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- multiple_button.hxx 9 Jul 2002 17:00:10 -0000       1.3
+++ multiple_button.hxx 11 Jul 2002 14:51:10 -0000      1.4
@@ -32,7 +32,8 @@
       
     public:
     
-      MultipleButton(const std::vector<Button*>& buttons_);
+      MultipleButton (const std::vector<Button*>& buttons_);
+     ~MultipleButton ();
 
       virtual bool is_pressed ();
       virtual void update (float delta);

Index: multiple_pointer.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_pointer.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- multiple_pointer.cxx        9 Jul 2002 17:00:10 -0000       1.2
+++ multiple_pointer.cxx        11 Jul 2002 14:51:10 -0000      1.3
@@ -21,9 +21,15 @@
 
 namespace Input
 {
-  MultiplePointer::MultiplePointer(const std::vector<Pointer*>& pointers_) : 
-                                   pointers(pointers_), 
x_pos_list(pointers.size()), y_pos_list(pointers.size())
+  MultiplePointer::MultiplePointer (const std::vector<Pointer*>& pointers_) : 
+                                    pointers(pointers_), 
x_pos_list(pointers.size()), y_pos_list(pointers.size())
+  {
+  }
+
+  MultiplePointer::~MultiplePointer ()
   {
+    for (unsigned int i = 0; i < pointers.size(); i++)
+      delete pointers[i];
   }
 
   float
@@ -46,7 +52,7 @@
   }    
 
   void
-  MultiplePointer::update(float delta)
+  MultiplePointer::update (float delta)
   {
     bool do_break = false;
   

Index: multiple_pointer.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/multiple_pointer.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- multiple_pointer.hxx        9 Jul 2002 17:00:10 -0000       1.2
+++ multiple_pointer.hxx        11 Jul 2002 14:51:10 -0000      1.3
@@ -38,6 +38,7 @@
     public:
 
       MultiplePointer (const std::vector<Pointer*>& pointers_);
+     ~MultiplePointer ();
     
       virtual float get_x_pos ();
       virtual float get_y_pos ();




reply via email to

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