因此,一个小时左右的时间来摆弄和尝试不同的库,似乎OIS(和SDL)只是将控制器识别为操纵杆,并为我提供了我需要的一切。
如果从上面的链接安装OIS,并创建/运行“ ConsoleTest”项目,则可以在调试窗口中看到控制器的输出。
另外,这里使用的枚举与SDL产生的轴/按钮编号匹配(请注意不是OIS,我现在决定不使用它,编号可能完全相同)。请注意,触发按钮未归类为轴,我很确定它们应该是(来自内存的0-255):
//Values SDL attributes to individual PS3 axes
enum EPS3RawAxesIndex
{
EPS3RawAxesIndex_LeftX = 0,
EPS3RawAxesIndex_LeftY = 1,
EPS3RawAxesIndex_RightX = 2,
EPS3RawAxesIndex_RightY = 3
};
//Values SDL attributes to individual PS3 controller buttons
enum EPS3RawButtonIndex
{
EPS3RawButtonIndex_Select = 0,
EPS3RawButtonIndex_JoyClickLeft = 1,
EPS3RawButtonIndex_JoyClickRight = 2,
EPS3RawButtonIndex_Start = 3,
EPS3RawButtonIndex_DpadUp = 4,
EPS3RawButtonIndex_DpadRight = 5,
EPS3RawButtonIndex_DpadDown = 6,
EPS3RawButtonIndex_DpadLeft = 7,
EPS3RawButtonIndex_TriggerLeft = 8,
EPS3RawButtonIndex_TriggerRight = 9,
EPS3RawButtonIndex_ShoulderLeft = 10,
EPS3RawButtonIndex_ShoulderRight = 11,
EPS3RawButtonIndex_Triangle = 12,
EPS3RawButtonIndex_Circle = 13,
EPS3RawButtonIndex_Cross = 14,
EPS3RawButtonIndex_Square = 15,
EPS3RawButtonIndex_PSButton = 16
};