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/axes Makefile.am, 1.4, 1.5 butt


From: Ingo Ruhnke
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input/axes Makefile.am, 1.4, 1.5 button_axis.cxx, 1.6, 1.7 button_axis.hxx, 1.5, 1.6 joystick_axis.cxx, 1.3, 1.4 joystick_axis.hxx, 1.4, 1.5
Date: Mon, 20 Oct 2003 15:33:46 +0200

Update of /var/lib/cvs/Games/Pingus/src/input/axes
In directory dark:/tmp/cvs-serv18306/input/axes

Modified Files:
        Makefile.am button_axis.cxx button_axis.hxx joystick_axis.cxx 
        joystick_axis.hxx 
Log Message:
- some namespace and CL0.7 stuff

Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/axes/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 19 Oct 2003 12:25:47 -0000      1.4
+++ Makefile.am 20 Oct 2003 13:33:44 -0000      1.5
@@ -17,7 +17,7 @@
 
 noinst_LIBRARIES = libpingus_input_axes.a
 
-libpingus_input_axes_CPPFLAGS = @PINGUS_CFLAGS@
+libpingus_input_axes_a_CPPFLAGS = @PINGUS_CFLAGS@
 libpingus_input_axes_a_SOURCES =       \
         button_axis.hxx button_axis.cxx \
        dummy_axis.hxx \

Index: button_axis.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/axes/button_axis.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- button_axis.cxx     19 Apr 2003 10:23:19 -0000      1.6
+++ button_axis.cxx     20 Oct 2003 13:33:44 -0000      1.7
@@ -20,61 +20,62 @@
 #include "button_axis.hxx"
 #include "../button.hxx"
 
+namespace Pingus {
 namespace Input {
+namespace Axes {
 
-  namespace Axes {
+ButtonAxis::ButtonAxis (float angle_, Button* button1_, Button* button2_) :
+  pos(0), angle(angle_), button1(button1_), button2(button2_)
+{
+  if (angle < 0)
+    angle = static_cast<float>((static_cast<int>(angle) % 360) + 360);
+  else if (angle > 360)
+    angle = static_cast<float>((static_cast<int>(angle) % 360) + 0);
+}
 
-    ButtonAxis::ButtonAxis (float angle_, Button* button1_, Button* button2_) :
-                            pos(0), angle(angle_), button1(button1_), 
button2(button2_)
-    {
-      if (angle < 0)
-        angle = static_cast<float>((static_cast<int>(angle) % 360) + 360);
-      else if (angle > 360)
-        angle = static_cast<float>((static_cast<int>(angle) % 360) + 0);
-    }
+ButtonAxis::~ButtonAxis ()
+{
+  delete button1;
+  delete button2;
+}
 
-    ButtonAxis::~ButtonAxis ()
-    {
-      delete button1;
-      delete button2;
-    }
+const float&
+ButtonAxis::get_pos () const
+{
+  return pos;
+}
 
-    const float&
-    ButtonAxis::get_pos () const
-    {
-      return pos;
-    }
+const float&
+ButtonAxis::get_angle () const
+{
+  return angle;
+}
 
-    const float&
-    ButtonAxis::get_angle () const
-    {
-      return angle;
-    }
+void
+ButtonAxis::update (float delta)
+{
+  button1->update(delta);
+  button2->update(delta);
 
-    void
-    ButtonAxis::update (float delta)
+  if (button1->is_pressed() == button2->is_pressed())
     {
-      button1->update(delta);
-      button2->update(delta);
-
-      if (button1->is_pressed() == button2->is_pressed())
-        {
-          pos = 0;
-         return;
-        }
-
-      if (button1->is_pressed() && pos > -1.0f)
-        pos -= delta;
-      else if (pos < 1.0f)
-        pos += delta;
-
-      if (pos < -1.0f)
-        pos = -1.0f;
-      else if (pos > 1.0f)
-        pos = 1.0f;
+      pos = 0;
+      return;
     }
 
-  }
+  if (button1->is_pressed() && pos > -1.0f)
+    pos -= delta;
+  else if (pos < 1.0f)
+    pos += delta;
+
+  if (pos < -1.0f)
+    pos = -1.0f;
+  else if (pos > 1.0f)
+    pos = 1.0f;
 }
 
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
+
 /* EOF */

Index: button_axis.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/axes/button_axis.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- button_axis.hxx     19 Apr 2003 10:23:19 -0000      1.5
+++ button_axis.hxx     20 Oct 2003 13:33:44 -0000      1.6
@@ -22,43 +22,45 @@
 
 #include "../axis.hxx"
 
+namespace Pingus {
 namespace Input {
 
-  class Button;
+class Button;
 
-  namespace Axes {
+namespace Axes {
 
-    /**
-      @brief maps two buttons into an axis
+/**
+   @brief maps two buttons into an axis
 
-      XML definition: <button-axis angle=?> <some button 1><some button 2> 
</button-axis>
-    */
-    class ButtonAxis : public Axis {
+   XML definition: <button-axis angle=?> <some button 1><some button 2> 
</button-axis>
+*/
+class ButtonAxis : public Axis {
 
-    private:
-      float pos;
-      float angle;
+private:
+  float pos;
+  float angle;
 
-      Button* const button1;
-      Button* const button2;
+  Button* const button1;
+  Button* const button2;
 
-    public:
+public:
 
-      ButtonAxis (float angle_, Button* button1_, Button* button2_);
-     ~ButtonAxis ();
+  ButtonAxis (float angle_, Button* button1_, Button* button2_);
+  ~ButtonAxis ();
 
-      virtual const float& get_pos () const;
-      virtual const float& get_angle () const;
+  virtual const float& get_pos () const;
+  virtual const float& get_angle () const;
 
-      virtual void  update (float delta);
+  virtual void  update (float delta);
 
-    private:
-      ButtonAxis (const ButtonAxis&);
-      ButtonAxis& operator= (const ButtonAxis&);
-    };
+private:
+  ButtonAxis (const ButtonAxis&);
+  ButtonAxis& operator= (const ButtonAxis&);
+};
 
-  }
-}
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
 
 #endif
 

Index: joystick_axis.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/axes/joystick_axis.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- joystick_axis.cxx   19 Oct 2003 12:25:47 -0000      1.3
+++ joystick_axis.cxx   20 Oct 2003 13:33:44 -0000      1.4
@@ -17,16 +17,18 @@
 //  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.h>
-#include <ClanLib/Display/inputdevice.h>
-#include <ClanLib/Display/inputaxis.h>
+//#include <ClanLib/Display/input.h>
+#include <ClanLib/Display/input_device.h>
+//#include <ClanLib/Display/inputaxis.h>
 #include "joystick_axis.hxx"
 #include "../../pingus_error.hxx"
 
+namespace Pingus {
 namespace Input {
 namespace Axes {
 
-JoystickAxis::JoystickAxis(int id_, int axis_, float angle_) : id(id_), 
axis(axis_), pos(0), angle(angle_)
+JoystickAxis::JoystickAxis(int id_, int axis_, float angle_) 
+  : id(id_), axis(axis_), pos(0), angle(angle_)
 {
   if (static_cast<unsigned int> (id) >= CL_Input::joysticks.size())
     PingusError::raise("JoystickAxis: Invalid joystick id");
@@ -58,7 +60,8 @@
   pos = CL_Input::joysticks[id]->get_axis(axis)->get_pos();
 }
 
-}
-}
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
 
 /* EOF */

Index: joystick_axis.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/axes/joystick_axis.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- joystick_axis.hxx   19 Apr 2003 10:23:19 -0000      1.4
+++ joystick_axis.hxx   20 Oct 2003 13:33:44 -0000      1.5
@@ -22,8 +22,8 @@
 
 #include "../axis.hxx"
 
+namespace Pingus {
 namespace Input {
-
 namespace Axes {
 
   /**
@@ -55,6 +55,7 @@
 
 } // namespace Axes
 } // namespace Input
+} // namespace Pingus
 
 #endif
 





reply via email to

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