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 button_axis.cxx,1.3,1.4 bu


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input/axes button_axis.cxx,1.3,1.4 button_axis.hxx,1.3,1.4
Date: 29 Oct 2002 17:47:18 -0000

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

Modified Files:
        button_axis.cxx button_axis.hxx 
Log Message:
- replaced ActionAxis with two buttons
- added a delay of one second before a ButtonAxis will reach maximum value


Index: button_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axes/button_axis.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- button_axis.cxx     14 Oct 2002 11:15:15 -0000      1.3
+++ button_axis.cxx     29 Oct 2002 17:47:15 -0000      1.4
@@ -19,6 +19,7 @@
 
 #include "button_axis.hxx"
 #include "../button.hxx"
+#include "../../debug.hxx"
 
 namespace Input {
 
@@ -62,12 +63,19 @@
           pos = 0;
          return;
         }
-    
-      if (button1->is_pressed())
+
+      if (button1->is_pressed() && pos > -1.0f)
+        pos -= delta;
+      else if (pos < 1.0f)
+        pos += delta;
+
+      if (pos < -1.0f)
         pos = -1.0f;
-      else
+      else if (pos > 1.0f)
         pos = 1.0f;
- 
+       
+      if (pos)
+        pwarn << "Pos: " << pos << std::endl;
     }
 
   }

Index: button_axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axes/button_axis.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- button_axis.hxx     27 Sep 2002 11:26:47 -0000      1.3
+++ button_axis.hxx     29 Oct 2002 17:47:15 -0000      1.4
@@ -36,9 +36,9 @@
     class ButtonAxis : public Axis {
 
     private:
-      float   pos;
-      float   angle;
-    
+      float pos;
+      float angle;
+
       Button* const button1;
       Button* const button2;
     





reply via email to

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