I'm a C++ newbie working on adding gamepad support to Moai as a learning exercise and because I'd like to be able to use a gamepad with it. I'm starting by implementing the Xbox 360 gamepad via XInput and that's going pretty well. Eventually I'd also like to support the PS3 gamepad.
This has got me thinking: the 360 and PS3 pads are mostly similar. They have the same number of buttons in more or less the same places that do more or less the same things (e.g., the right trigger on the 360 pad is an analog trigger, so is the R2 trigger on the PS3 pad). From the standpoint of creating an API to support both pads the main difference is the labeling applied to each button.
The PS3 square button is in the same place as the 360 X button, triangle matches Y, circle matches B, and X matches A. Some comparison images:
When creating the API to work with gamepads I see a couple ways to approach it:
- Use the 360 naming conventions exclusively.
- Use the PS3 naming conventions exclusively.
- Come up with something in between.
I'd like to go with option #3 and could devise my own solution easy enough but don't want to reinvent the wheel unnecessarily.
Is there some standard naming convention used for a gamepad API that supports both 360 and PS3 (and possibly other, similar) gamepads? Is this even really an issue -- should I just create an API, document it and call it good?