From 560fd191accb68b649b21fef14f16b49d85df2f3 Mon Sep 17 00:00:00 2001 From: ehofman <ehofman> Date: Wed, 4 Jun 2003 12:46:49 +0000 Subject: [PATCH] Restrict the update limitation to the buttons only --- src/Input/input.cxx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 26fd15bc5..18fd7cdb1 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -698,11 +698,7 @@ FGInput::_update_joystick (double dt) // float js_val, diff; float axis_values[MAX_JOYSTICK_AXES]; - // update the joystick 20 times per second. - if ((_last_dt += dt) > 50) - _last_dt = 0.0; - else - return; + _last_dt += dt; for ( i = 0; i < MAX_JOYSTICKS; i++) { @@ -745,13 +741,20 @@ FGInput::_update_joystick (double dt) } // Fire bindings for the buttons. - for (j = 0; j < _joystick_bindings[i].nbuttons; j++) { - _update_button(_joystick_bindings[i].buttons[j], - modifiers, - (buttons & (1 << j)) > 0, - -1, -1); + if (_last_dt > 0.05) { + for (j = 0; j < _joystick_bindings[i].nbuttons; j++) { + _update_button(_joystick_bindings[i].buttons[j], + modifiers, + (buttons & (1 << j)) > 0, + -1, -1); + } } } + + if (_last_dt > 0.05) { + while(_last_dt >= 0.05) + _last_dt -= 0.05; + } } void