|
|
|
@ -119,6 +119,9 @@ void JoystickWidget::updateUIForJoystick(int id)
@@ -119,6 +119,9 @@ void JoystickWidget::updateUIForJoystick(int id)
|
|
|
|
|
|
|
|
|
|
// And add the necessary button displays for this joystick.
|
|
|
|
|
int newButtons = joystick->getJoystickNumButtons(); |
|
|
|
|
if (newButtons) |
|
|
|
|
{ |
|
|
|
|
m_ui->buttonBox->show(); |
|
|
|
|
for (int i = 0; i < newButtons; i++) |
|
|
|
|
{ |
|
|
|
|
JoystickButton* button = new JoystickButton(i, m_ui->buttonBox); |
|
|
|
@ -126,9 +129,17 @@ void JoystickWidget::updateUIForJoystick(int id)
@@ -126,9 +129,17 @@ void JoystickWidget::updateUIForJoystick(int id)
|
|
|
|
|
m_ui->buttonLayout->insertWidget(i, button); |
|
|
|
|
buttons.append(button); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
m_ui->buttonBox->hide(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Do the same for the axes supported by this joystick.
|
|
|
|
|
for (int i = 0; i < joystick->getJoystickNumAxes(); i++) |
|
|
|
|
int newAxes = joystick->getJoystickNumAxes(); |
|
|
|
|
if (newAxes) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < newAxes; i++) |
|
|
|
|
{ |
|
|
|
|
JoystickAxis* axis = new JoystickAxis(i, m_ui->axesBox); |
|
|
|
|
axis->setValue(joystick->getCurrentValueForAxis(i)); |
|
|
|
@ -138,6 +149,11 @@ void JoystickWidget::updateUIForJoystick(int id)
@@ -138,6 +149,11 @@ void JoystickWidget::updateUIForJoystick(int id)
|
|
|
|
|
m_ui->axesLayout->insertWidget(i, axis); |
|
|
|
|
axes.append(axis); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
m_ui->buttonBox->hide(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void JoystickWidget::updateAxisValue(int axis, float value) |
|
|
|
|