Skip to content

Chore: add deadzone for handling for over-active x/y analog inputs #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions DeltaCore/Model/GameControllerStateManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ extension GameControllerStateManager
{
precondition(input.type == .controller(self.gameController.inputType), "input.type must match self.gameController.inputType")

if input.type == .controller(.mfi) && input.isContinuous
{
// Some external controllers' analog sticks report both x/y axis values incredibly granularly,
// hindering the ability to use the analog stick for only a single x/y axis value at a time.
// Solution: apply a higher deadzone to the analog sticks (currently the only continuous inputs)
// TODO: this could be a user-configurable threshold, but DeltaCore doesn't yet support configurable settings
guard value > 0.15 else { return }
}

// An input may be "activated" multiple times, such as by pressing different buttons that map to same input, or moving an analog stick.
self.activatedInputs[AnyInput(input)] = value

Expand Down