Do not try to initialize all 16 joysticks every frame if they where not found previously. Try it once every second instead.
This commit is contained in:
parent
ab7e7ec7b4
commit
3cb05a9207
2 changed files with 6 additions and 1 deletions
|
@ -344,7 +344,11 @@ void FGJoystickInput::updateJoystick(int index, FGJoystickInput::joystick* joy,
|
|||
if (js == 0 || js->notWorking()) {
|
||||
joysticks[index].initializing = true;
|
||||
if (js) {
|
||||
joysticks[index].plibJS.reset( new jsJoystick(index) );
|
||||
joysticks[index].init_dt += dt;
|
||||
if (joysticks[index].init_dt >= 1.0) {
|
||||
joysticks[index].plibJS.reset( new jsJoystick(index) );
|
||||
joysticks[index].init_dt = 0.0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ private:
|
|||
bool initializing = true;
|
||||
bool initialized = false;
|
||||
float values[MAX_JOYSTICK_AXES];
|
||||
double init_dt = 0.0f;
|
||||
|
||||
void clearAxesAndButtons();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue