Update the joystick 20 times per second
This commit is contained in:
parent
f39e079b75
commit
a2a496a84b
2 changed files with 16 additions and 12 deletions
|
@ -194,9 +194,9 @@ FGInput::init ()
|
||||||
void
|
void
|
||||||
FGInput::update (double dt)
|
FGInput::update (double dt)
|
||||||
{
|
{
|
||||||
_update_keyboard();
|
_update_keyboard(dt);
|
||||||
_update_joystick();
|
_update_joystick(dt);
|
||||||
_update_mouse();
|
_update_mouse(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -683,22 +683,26 @@ FGInput::_init_button (const SGPropertyNode * node,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FGInput::_update_keyboard ()
|
FGInput::_update_keyboard (double dt)
|
||||||
{
|
{
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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 modifiers = FG_MOD_NONE; // FIXME: any way to get the real ones?
|
||||||
int buttons;
|
int i, j, buttons;
|
||||||
// float js_val, diff;
|
// float js_val, diff;
|
||||||
float axis_values[MAX_JOYSTICK_AXES];
|
float axis_values[MAX_JOYSTICK_AXES];
|
||||||
|
|
||||||
int i;
|
// update the joystick 20 times per second.
|
||||||
int j;
|
if ((dt += dt) > 50)
|
||||||
|
_last_dt = 0.0;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
for ( i = 0; i < MAX_JOYSTICKS; i++) {
|
for ( i = 0; i < MAX_JOYSTICKS; i++) {
|
||||||
|
|
||||||
|
@ -751,7 +755,7 @@ FGInput::_update_joystick ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGInput::_update_mouse ()
|
FGInput::_update_mouse (double dt)
|
||||||
{
|
{
|
||||||
mouse &m = _mouse_bindings[0];
|
mouse &m = _mouse_bindings[0];
|
||||||
int mode = m.mode_node->getIntValue();
|
int mode = m.mode_node->getIntValue();
|
||||||
|
|
|
@ -375,19 +375,19 @@ private:
|
||||||
/**
|
/**
|
||||||
* Update the keyboard.
|
* Update the keyboard.
|
||||||
*/
|
*/
|
||||||
void _update_keyboard ();
|
void _update_keyboard (double dt);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the joystick.
|
* Update the joystick.
|
||||||
*/
|
*/
|
||||||
void _update_joystick ();
|
void _update_joystick (double dt);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the mouse.
|
* Update the mouse.
|
||||||
*/
|
*/
|
||||||
void _update_mouse ();
|
void _update_mouse (double dt);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue