]> git.mxchange.org Git - flightgear.git/commitdiff
Update the joystick 20 times per second
authorehofman <ehofman>
Wed, 4 Jun 2003 09:30:48 +0000 (09:30 +0000)
committerehofman <ehofman>
Wed, 4 Jun 2003 09:30:48 +0000 (09:30 +0000)
src/Input/input.cxx
src/Input/input.hxx

index 9e236f26910f3c69c68d3d4b4fea1a470096c205..95b141a633d3a05404d5d2427a110e10b4cbe125 100644 (file)
@@ -194,9 +194,9 @@ FGInput::init ()
 void 
 FGInput::update (double dt)
 {
-  _update_keyboard();
-  _update_joystick();
-  _update_mouse();
+  _update_keyboard(dt);
+  _update_joystick(dt);
+  _update_mouse(dt);
 }
 
 void
@@ -683,22 +683,26 @@ FGInput::_init_button (const SGPropertyNode * node,
 
 
 void
-FGInput::_update_keyboard ()
+FGInput::_update_keyboard (double dt)
 {
   // no-op
 }
 
 
 void
-FGInput::_update_joystick ()
+FGInput::_update_joystick (double dt)
 {
+  static double _last_dt = 0.0;
   int modifiers = FG_MOD_NONE;  // FIXME: any way to get the real ones?
-  int buttons;
+  int i, j, buttons;
   // float js_val, diff;
   float axis_values[MAX_JOYSTICK_AXES];
 
-  int i;
-  int j;
+  // update the joystick 20 times per second.
+  if ((dt += dt) > 50)
+    _last_dt = 0.0;
+  else
+    return;
 
   for ( i = 0; i < MAX_JOYSTICKS; i++) {
 
@@ -751,7 +755,7 @@ FGInput::_update_joystick ()
 }
 
 void
-FGInput::_update_mouse ()
+FGInput::_update_mouse (double dt)
 {
   mouse &m = _mouse_bindings[0];
   int mode =  m.mode_node->getIntValue();
index 2ca5568a68d72bdb8739d75e4a37a5433ec855a5..d0050f8219fbb9c6e61af27a19be687e28f4c54e 100644 (file)
@@ -375,19 +375,19 @@ private:
   /**
    * Update the keyboard.
    */
-  void _update_keyboard ();
+  void _update_keyboard (double dt);
 
 
   /**
    * Update the joystick.
    */
-  void _update_joystick ();
+  void _update_joystick (double dt);
 
 
   /**
    * Update the mouse.
    */
-  void _update_mouse ();
+  void _update_mouse (double dt);
 
 
   /**