Skip to content
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

Configurable button and axis mapping #9

Open
Oblomov opened this issue Jul 27, 2017 · 2 comments
Open

Configurable button and axis mapping #9

Oblomov opened this issue Jul 27, 2017 · 2 comments

Comments

@Oblomov
Copy link
Owner

Oblomov commented Jul 27, 2017

A nice thing to have would be a method to configure the button mapping, to work around limitations in clients that do not support it themselves.

Examples of what this should allow achieving:

A default configuration should be provided (e.g. the current one), together with a set of default alternatives. It should be possible to combine configuration file (e.g. 'portrait d-pad plus button swapping').

The syntax should be as simple as possible, without being exceedingly verbose. We probably won't need more than a couple of directives:

wii button or axis specification = action specification

for the mappings themselves, and

#include 'other configuration'

Both the Wii button/axis specification and the corresponding action should have clearly readable names; we can base them on the defines, but to improve readability and writeability we might want to allow both _ and as separator for components, and prefixes such as XWII or BTN could be made optional, also allowing key and button as synonyms. So, for example, the swap could be written as:

XWII_KEY_A = BTN_1
XWII_KEY_B = BTN_2
XWII_KEY_ONE = BTN_A
XWII_KEY_TWO = BTN_B

but also

button a = button 1
button a = button 2
button 1 = button a
button 2 = button b

or even

a = 1
b = 2
1 = a
2 = b
@tomsik68
Copy link

tomsik68 commented Jul 27, 2017

I might be over-engineering a little bit here, but I got another idea that takes this one step further: What if users could define the virtual joystick themselves?
We could add mappings from axes to buttons or vice versa. Some examples:

  • axis 1 max = button 3 (if real axis 1 gets (close) to its maximum value, "press" virtual button 3)
  • button 1 = axis 2 min (if button 1 is pressed, set value of virtual axis 2 to its minimum value)
  • button 2 = button a
  • axis 3 = axis 5

That would make it possible to create virtual axes(like in my previous patch) and also virtual buttons.

@Oblomov
Copy link
Owner Author

Oblomov commented Jul 27, 2017

I don't see why we shouldn't allow it, although I'd be very surprised if the mapping axis -> button ever finds an actual use. Unless of course supporting it would make the code too complex.

I don't particularly like the proposed syntax with max/min though. An axis should probably map to a pair of buttons, and conversely we'd need a pair of buttons to create another axis, plus maybe the keywod none to indicate a dead map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants