1
0
Fork 0

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:
Erik Hofman 2020-03-12 10:31:38 +01:00
parent ab7e7ec7b4
commit 3cb05a9207
2 changed files with 6 additions and 1 deletions

View file

@ -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;
}

View file

@ -104,6 +104,7 @@ private:
bool initializing = true;
bool initialized = false;
float values[MAX_JOYSTICK_AXES];
double init_dt = 0.0f;
void clearAxesAndButtons();
};