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 button_axis.cxx,1.1,1.2 joystic


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input button_axis.cxx,1.1,1.2 joystick_axis.cxx,1.1,1.2
Date: 5 Jul 2002 10:06:37 -0000

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

Modified Files:
        button_axis.cxx joystick_axis.cxx 
Log Message:
normalize angle


Index: button_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button_axis.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- button_axis.cxx     4 Jul 2002 13:11:57 -0000       1.1
+++ button_axis.cxx     5 Jul 2002 10:06:35 -0000       1.2
@@ -23,8 +23,13 @@
 namespace Input
 {
   ButtonAxis::ButtonAxis(float angle_, Button* button1_, Button* button2_) : 
-                         angle(angle_), button1(button1_), button2(button2_) { 
}
-
+                         angle(angle_), button1(button1_), button2(button2_) 
+  {
+    if (angle < 0)
+      angle = (angle % 360) + 360;
+    else if (angle > 360)
+      angle = angle % 360;
+  }
 
   float
   ButtonAxis::get_pos ()

Index: joystick_axis.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/joystick_axis.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- joystick_axis.cxx   4 Jul 2002 14:03:43 -0000       1.1
+++ joystick_axis.cxx   5 Jul 2002 10:06:35 -0000       1.2
@@ -24,8 +24,13 @@
 
 namespace Input
 {
-  JoystickAxis::JoystickAxis(int id_, int axis_, float angle_) : id(id_), 
axis(axis_), angle(angle_) { }
-
+  JoystickAxis::JoystickAxis(int id_, int axis_, float angle_) : id(id_), 
axis(axis_), angle(angle_)
+  {
+    if (angle < 0)
+      angle = (angle % 360) + 360;
+    else if (angle > 360)
+      angle = angle % 360;
+  }
 
   float
   JoystickAxis::get_pos ()




reply via email to

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