Skip to content

Commit

Permalink
Reduce jank for trigger to stick mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Nov 1, 2023
1 parent 92f4786 commit 0c827a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Core/Key2Joy.Core/Mapping/Actions/Input/GamePadStickAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ public override async Task Execute(AbstractInputBag inputBag = null)
{
// TODO: This is now hard-coded, but I'd love for 'modifiers' to exist in between triggers and actions. Those could (with more fine tuning) be configured by the user.
deltaX = Scale((int)(triggerInputBag.LeftTriggerDelta * XInputGamePad.TriggerValueMax), this.InputScaleX);
if (deltaX > 0)
{
// For triggers we need to not have a delta, but simply a value that maps directly to the stick value (feels better)
state.LeftStickX = 0;
state.RightStickX = 0;
}
}

if (this.DeltaY is not null)
Expand All @@ -195,6 +201,12 @@ public override async Task Execute(AbstractInputBag inputBag = null)
else if (inputBag is GamePadTriggerInputBag triggerInputBag)
{
deltaY = Scale((int)(triggerInputBag.RightTriggerDelta * XInputGamePad.TriggerValueMax), this.InputScaleY);
if (deltaY > 0)
{
// For triggers we need to not have a delta, but simply a value that maps directly to the stick value (feels better)
state.LeftStickY = 0;
state.RightStickY = 0;
}
}

if (this.Side == GamePadSide.Left)
Expand Down

0 comments on commit 0c827a4

Please sign in to comment.