Browse Source

input: support up to 16 buttons in Xbox-like pads.

legacy
Sam Hocevar sam 12 years ago
parent
commit
736b5a2659
2 changed files with 8 additions and 2 deletions
  1. +4
    -1
      src/platform/d3d9/d3d9input.cpp
  2. +4
    -1
      src/platform/xbox/xboxinput.cpp

+ 4
- 1
src/platform/d3d9/d3d9input.cpp View File

@@ -53,7 +53,7 @@ D3d9Input::D3d9Input()

Stick *stick = Input::CreateStick();
stick->SetAxisCount(4);
stick->SetButtonCount(0);
stick->SetButtonCount(16);
m_data->m_joysticks.Push(i, stick);
}
#endif
@@ -94,6 +94,9 @@ void D3d9Input::TickDraw(float seconds)
m_data->m_joysticks[i].m2->SetAxis(1, -(float)state.Gamepad.sThumbLY / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(2, (float)state.Gamepad.sThumbRX / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(3, -(float)state.Gamepad.sThumbRY / 32768.f);

for (int b = 0; b < 16; b++)
m_data->m_joysticks[i].m2->SetButton(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1);
}
#endif
}


+ 4
- 1
src/platform/xbox/xboxinput.cpp View File

@@ -53,7 +53,7 @@ XboxInput::XboxInput()

Stick *stick = Input::CreateStick();
stick->SetAxisCount(4);
stick->SetButtonCount(0);
stick->SetButtonCount(16);
m_data->m_joysticks.Push(i, stick);
}
#endif
@@ -94,6 +94,9 @@ void XboxInput::TickDraw(float seconds)
m_data->m_joysticks[i].m2->SetAxis(1, -(float)state.Gamepad.sThumbLY / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(2, (float)state.Gamepad.sThumbRX / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(3, -(float)state.Gamepad.sThumbRY / 32768.f);

for (int b = 0; b < 16; b++)
m_data->m_joysticks[i].m2->SetButton(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1);
}
#endif
}


Loading…
Cancel
Save