瀏覽代碼

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

legacy
Sam Hocevar sam 12 年之前
父節點
當前提交
736b5a2659
共有 2 個檔案被更改,包括 8 行新增2 行删除
  1. +4
    -1
      src/platform/d3d9/d3d9input.cpp
  2. +4
    -1
      src/platform/xbox/xboxinput.cpp

+ 4
- 1
src/platform/d3d9/d3d9input.cpp 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存