[Development] some questions about QtGamePad

Matthew Woehlke mwoehlke.floss at gmail.com
Mon Feb 15 19:04:04 CET 2016


On 2016-02-15 06:36, pritam.ghanghas at gmail.com wrote:
> Looking at the API it seems it has a very hard assumption on 2 sticks and
> 18 buttons.

Please support arbitrary axes and buttons, as done in e.g. SDL.
Hard-coding this stuff is a terrible idea, as even devices with similar
physical configurations may number their inputs differently.
(Hard-coding the *nature* of the buttons, e.g. "home", "guide" is *also*
a terrible design; not all controllers have anything like these.)

Three controllers I have offhand have the following attributes:

  - 4 axes, 12 buttons, 1 hat
  - 5 axes, 8/9¹ buttons, 1 hat
  - 6 axes², 11 buttons, 1 hat

These are, respectively, a Logitech WingMan Rumble Pad, Logitech Extreme
3D Pro, and standard XBox 360 controller. (I do note that you're at
least treating the analog triggers as axes and not buttons.) Note that
the second in particular has *one* stick with *three* axes (plus a
throttle control).

How do you even handle hats???

Then there are e.g. standard Wii controllers which have, I think, 6/7²
axes (*none* of which are sticks), 6/7² buttons, and 1 hat. The nunchuck
has at *8* (or 9²) axis, 1/2² buttons, and no hat.

Please, *please* take the SDL approach and just support axes, buttons
and hats (all in arbitrary number) without trying to assign any
particular meaning to any of the above. (And keep in mind that axes can
be self-centering, i.e. sticks, triggers, acceleromaters, or not, i.e.
throttles, gyroscopes.) This way you support just about any device,
including a degree of future-proofing.

(¹ I think one of the buttons may be treated specially by the hardware
and not generally "visible". I don't have the pad with me to check, though.)

(² I don't have a Wii controller to test, and I'm not sure if the
trigger is analog (axis) or digital (button).)

-- 
Matthew




More information about the Development mailing list