Explorar el Código

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

legacy
Sam Hocevar sam hace 12 años
padre
commit
736b5a2659
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. +4
    -1
      src/platform/d3d9/d3d9input.cpp
  2. +4
    -1
      src/platform/xbox/xboxinput.cpp

+ 4
- 1
src/platform/d3d9/d3d9input.cpp Ver fichero

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


Stick *stick = Input::CreateStick(); Stick *stick = Input::CreateStick();
stick->SetAxisCount(4); stick->SetAxisCount(4);
stick->SetButtonCount(0);
stick->SetButtonCount(16);
m_data->m_joysticks.Push(i, stick); m_data->m_joysticks.Push(i, stick);
} }
#endif #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(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(2, (float)state.Gamepad.sThumbRX / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(3, -(float)state.Gamepad.sThumbRY / 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 #endif
} }


+ 4
- 1
src/platform/xbox/xboxinput.cpp Ver fichero

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


Stick *stick = Input::CreateStick(); Stick *stick = Input::CreateStick();
stick->SetAxisCount(4); stick->SetAxisCount(4);
stick->SetButtonCount(0);
stick->SetButtonCount(16);
m_data->m_joysticks.Push(i, stick); m_data->m_joysticks.Push(i, stick);
} }
#endif #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(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(2, (float)state.Gamepad.sThumbRX / 32768.f);
m_data->m_joysticks[i].m2->SetAxis(3, -(float)state.Gamepad.sThumbRY / 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 #endif
} }


Cargando…
Cancelar
Guardar