Added D-Pad support
This commit is contained in:
@@ -169,6 +169,40 @@ void loop() {
|
||||
XInput.release(BUTTON_R3);
|
||||
}
|
||||
|
||||
// D-Pad
|
||||
// D-Left
|
||||
if (ps2x.ButtonPressed(PSB_PAD_LEFT)) {
|
||||
XInput.press(DPAD_LEFT);
|
||||
}
|
||||
|
||||
if (ps2x.ButtonReleased(PSB_PAD_LEFT)) {
|
||||
XInput.release(DPAD_LEFT);
|
||||
}
|
||||
// D-Right
|
||||
if (ps2x.ButtonPressed(PSB_PAD_RIGHT)) {
|
||||
XInput.press(DPAD_RIGHT);
|
||||
}
|
||||
|
||||
if (ps2x.ButtonReleased(PSB_PAD_RIGHT)) {
|
||||
XInput.release(DPAD_RIGHT);
|
||||
}
|
||||
// D-Up
|
||||
if (ps2x.ButtonPressed(PSB_PAD_UP)) {
|
||||
XInput.press(DPAD_UP);
|
||||
}
|
||||
|
||||
if (ps2x.ButtonReleased(PSB_PAD_UP)) {
|
||||
XInput.release(DPAD_UP);
|
||||
}
|
||||
// D-Down
|
||||
if (ps2x.ButtonPressed(PSB_PAD_DOWN)) {
|
||||
XInput.press(DPAD_DOWN);
|
||||
}
|
||||
|
||||
if (ps2x.ButtonReleased(PSB_PAD_DOWN)) {
|
||||
XInput.release(DPAD_DOWN);
|
||||
}
|
||||
|
||||
// Left stick
|
||||
XInput.setJoystick(JOY_LEFT, ps2x.Analog(PSS_LX), 255 - ps2x.Analog(PSS_LY));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user