We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2189

Summary: Cannot define DPad to axes
Product: SDL Reporter: Joseph Carter <tjcarter>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.1   
Hardware: x86   
OS: Other   

Description Joseph Carter 2013-10-27 16:55:50 UTC
A number of controllers on the market have digital DPads that emulate analog axes.  There currently does not exist a method to bind "half" an axis to a button.

Two possibilities exist to fix this.  The first one is a bit of a hack, but it changes no ABI.  You would define a DPad thusly:

dpup:a4,dpdown:a4,dpleft:a3,dpright:a3

Presently, if you do this, movement on a3 (either direction) presses both dpleft and dpright, and likewise for a4 and dpup/dpdown.  The code can be modified to check the special case of a DPad button and assume negative axis values trigger left/up and positive trigger down/right.  This maintains ABI compatibility with 2.0.0 and 2.0.1.


Option #2 introduces new syntax for the mapping string.  This would be an addition, but currently just about all of the GameController mapping structure and functions are exposed to the outside, even if nobody is (or should be) using them.  The mapping would look like:

dpup:a4-,dpdown:a4+,dpleft:a3-,dpright:a3+

The forward and reverse mapping structures would have to change accordingly.  On the other hand, it offers the chance to implement "a0/" as a way to invert an axis or something.  :)


If we were dealing with a not-yet-released 2.0.0, I'd say do the latter.  Because we're post-release, I think we kind of have to do the former for ABI reasons.
Comment 1 Sam Lantinga 2013-11-11 01:49:08 UTC
I'm merging this bug into bug 2181 for a general improvement to the mapping syntax.

*** This bug has been marked as a duplicate of bug 2181 ***