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 axis_factory.cxx,1.12,1.13 butt


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx,1.12,1.13 button_event.hxx,1.4,1.5 controller.cxx,1.23,1.24 controller.hxx,1.14,1.15
Date: 29 Oct 2002 17:47:18 -0000

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

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


Index: axis_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_factory.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- axis_factory.cxx    28 Sep 2002 19:31:06 -0000      1.12
+++ axis_factory.cxx    29 Oct 2002 17:47:15 -0000      1.13
@@ -27,6 +27,7 @@
 #include "axes/joystick_axis.hxx"
 #include "axes/mouse_axis.hxx"
 #include "axes/multiple_axis.hxx"
+#include "../debug.hxx"
 
 namespace Input {
 

Index: button_event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button_event.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- button_event.hxx    27 Sep 2002 11:26:46 -0000      1.4
+++ button_event.hxx    29 Oct 2002 17:47:15 -0000      1.5
@@ -25,7 +25,8 @@
 namespace Input {
 
   enum ButtonName { primary, secondary, pause, fast_forward, armageddon, 
escape, action_1, action_2,
-                    action_3, action_4, action_5, action_6, action_7, 
action_8, action_9, action_10 };
+                    action_3, action_4, action_5, action_6, action_7, 
action_8, action_9, action_10,
+                   action_up, action_down };
 
   enum State { pressed, released };
 

Index: controller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/controller.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- controller.cxx      11 Sep 2002 13:16:45 -0000      1.23
+++ controller.cxx      29 Oct 2002 17:47:15 -0000      1.24
@@ -40,8 +40,7 @@
   using namespace Pointers;
   using namespace Scrollers;
 
-  Controller::Controller (const std::string& configfile) : action_axis(0),
-                                                           
standard_pointer(0), 
+  Controller::Controller (const std::string& configfile) : 
standard_pointer(0), 
                                                           scroller(0),
                                                           std_pointer_x(0),
                                                           std_pointer_y(0)
@@ -97,8 +96,11 @@
        else if (XMLhelper::equal_str(cur->name, "action-buttons"))
          create_action_buttons(XMLhelper::skip_blank(cur->children));
        
-       else if (XMLhelper::equal_str(cur->name, "action-axis"))
-         action_axis = 
AxisFactory::create(XMLhelper::skip_blank(cur->children));
+       else if (XMLhelper::equal_str(cur->name, "action-up"))
+         buttons[action_up].first = 
ButtonFactory::create(XMLhelper::skip_blank(cur->children));
+       
+       else if (XMLhelper::equal_str(cur->name, "action-down"))
+         buttons[action_down].first = 
ButtonFactory::create(XMLhelper::skip_blank(cur->children));
          
        else
          PingusError::raise(std::string("Unkown Element in Controller Config: 
") + ((cur->name) ? reinterpret_cast<const char*>(cur->name) : ""));
@@ -123,12 +125,6 @@
        pwarn << "Controller: No scroller - inserting dummy" << std::endl;
       }
       
-    if (!action_axis)
-      {
-        action_axis = new DummyAxis;
-       pwarn << "Controller: No action axis button - inserting dummy" << 
std::endl;
-      }
-      
     if (!buttons.count(primary))
       {
         buttons[primary].first = new DummyButton;
@@ -164,6 +160,18 @@
         buttons[escape].first = new DummyButton;
        pwarn << "Controller: No escape button - inserting dummy" << std::endl;
       }
+      
+    if (!buttons.count(action_up))
+      {
+        buttons[action_up].first = new DummyButton;
+       pwarn << "Controller: No action up button - inserting dummy" << 
std::endl;
+      }
+      
+    if (!buttons.count(action_down))
+      {
+        buttons[action_down].first = new DummyButton;
+       pwarn << "Controller: No action down button - inserting dummy" << 
std::endl;
+      }
 
     for (std::map<ButtonName, std::pair<Button*, bool> >::iterator it = 
buttons.begin(); it != buttons.end(); ++it)
       it->second.second = it->second.first->is_pressed();
@@ -202,7 +210,6 @@
 
     scroller        ->update(delta);
     standard_pointer->update(delta);
-    action_axis     ->update(delta);
 
     for (std::map<ButtonName, std::pair<Button*, bool> >::iterator it = 
buttons.begin(); it != buttons.end(); ++it)
       it->second.first->update(delta);
@@ -227,10 +234,6 @@
          else
            events.push_back(new ButtonEvent(it->first, released));
        }
-    
-    const float& temp = action_axis->get_pos();
-    if (temp)
-      events.push_back(new AxisEvent(temp));
   }
 
   const Button*

Index: controller.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/controller.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- controller.hxx      27 Sep 2002 11:26:46 -0000      1.14
+++ controller.hxx      29 Oct 2002 17:47:15 -0000      1.15
@@ -38,7 +38,6 @@
   class Controller {
 
     private:
-      Axis*     action_axis;
       Pointer*  standard_pointer;
       Scroller* scroller;
     
@@ -56,7 +55,6 @@
       
       const Pointer * get_pointer     () const { return standard_pointer; }
       const Scroller* get_scroller    () const { return scroller;         }
-      const Axis    * get_action_axis () const { return action_axis;      }
 
       /// returns the requested Buttons::Button or 0 if it doesn't exist (e.g. 
undefined action Buttons::Button)
       const Button* get_button (ButtonName name);





reply via email to

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