And SDL_JoystickNumButtons is probably necessary when you end up with
a controller that’s even remotely different to the current “standard”
controllers (e.g. one with 6 face buttons instead of 4).
Can you give a specific example? Basically, I’ve thought of the
following scenario:
Using a touchscreen or some other input mechanism, you navigate to a
configuration menu with a list of in-game actions, such as “Jump” and
“Crouch”. You may select an action and then push a button on an
arbitrary game controller, which will be used for applying the action
from now on. Similarly, the directions of D-pads and analog axes can
also be mapped.
All that I think is needed here is a way to identify the buttons in some
way, not the total amount of buttons. I suppose that if one wants a game
to ignore controllers that don’t have enough buttons then it is a
problem. Specific models can still be detected (well guessed), though.
In that example the vast majority of both joystick APIs is useless
though, since other than initialization about everything can be
handled with events. It isn’t just specific to SDL_JoystickNumButtons.
If you’re using that function then chances are you probably aren’t
using the events for input either, and you probably want to know how
many buttons need to be polled.
2013/2/2, NY00123 :> 2013/02/01, Sik the hedgehog
And SDL_JoystickNumButtons is probably necessary when you end up with
a controller that’s even remotely different to the current “standard”
controllers (e.g. one with 6 face buttons instead of 4).
Can you give a specific example? Basically, I’ve thought of the
following scenario:
Using a touchscreen or some other input mechanism, you navigate to a
configuration menu with a list of in-game actions, such as “Jump” and
“Crouch”. You may select an action and then push a button on an
arbitrary game controller, which will be used for applying the action
from now on. Similarly, the directions of D-pads and analog axes can
also be mapped.
All that I think is needed here is a way to identify the buttons in some
way, not the total amount of buttons. I suppose that if one wants a game
to ignore controllers that don’t have enough buttons then it is a
problem. Specific models can still be detected (well guessed), though.