mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 05:26:24 +02:00
Add L/R trigger button tilt support.
This commit is contained in:
1 parent
a89245a387
commit
64da0f54e4
3 files changed
+28
-3
No files matched your search
@@ -89,6 +89,10 @@ void TiltEventProcessor::TranslateTiltToInput(const Tilt &tilt) {
|
||||
case TILT_ACTION_BUTTON:
|
||||
GenerateActionButtonEvent(tilt);
|
||||
break;
|
||||
|
||||
case TILT_TRIGGER_BUTTON:
|
||||
GenerateTriggerButtonEvent(tilt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +158,25 @@ void TiltEventProcessor::GenerateActionButtonEvent(const Tilt &tilt) {
|
||||
tiltButtonsDown |= buttons[direction];
|
||||
}
|
||||
|
||||
void TiltEventProcessor::GenerateTriggerButtonEvent(const Tilt &tilt) {
|
||||
u32 upButtons = 0;
|
||||
u32 downButtons = 0;
|
||||
// KISS, let's only look at X. Expect deadzone to already be applied.
|
||||
if (tilt.x_ == 0.0f) {
|
||||
upButtons = CTRL_LTRIGGER | CTRL_RTRIGGER;
|
||||
} else if (tilt.x_ < 0.0f) {
|
||||
downButtons = CTRL_LTRIGGER;
|
||||
upButtons = CTRL_RTRIGGER;
|
||||
} else if (tilt.x_ > 0.0f) {
|
||||
downButtons = CTRL_RTRIGGER;
|
||||
upButtons = CTRL_LTRIGGER;
|
||||
}
|
||||
|
||||
__CtrlButtonUp(upButtons);
|
||||
__CtrlButtonDown(downButtons);
|
||||
tiltButtonsDown = (tiltButtonsDown & ~upButtons) | downButtons;
|
||||
}
|
||||
|
||||
void TiltEventProcessor::ResetTiltEvents() {
|
||||
// Reset the buttons we have marked pressed.
|
||||
__CtrlButtonUp(tiltButtonsDown);
|
||||
|
||||
Reference in new issue
Block a user